1. Knowledge Base
  2. Posts Table Pro
  3. Advanced Usage

Changing the search placeholder text (Posts Table Pro)

A ‘placeholder’ is the light-grey text shown inside a text box or form input before you start typing. They usually give some hint as to what to type in that box.

The search box shown above the post tables doesn’t have a placeholder by default. However, if you would like to use one, you can add a placeholder using the posts_table_language_defaults¬†filter. To do this, you will need to add the following code to your theme’s functions.php file:

function ptp_set_language_defaults( $defaults ) {
    $defaults['searchPlaceholder'] = 'Search...'; // the search box placeholder
    return $defaults;
}
add_filter( 'posts_table_language_defaults', 'ptp_set_language_defaults' );

If you also want to remove the ‘Search:’ label shown in front of the box, you can use the same filter, and set the ‘search’ property to a blank string. Amending the above code would give:

function ptp_set_language_defaults( $defaults ) {
    $defaults['searchPlaceholder'] = 'Search...';
    $defaults['search'] = ''; // the search label
    return $defaults;
}
add_filter( 'posts_table_language_defaults', 'ptp_set_language_defaults' );
Still need help?
If searching the knowledge base hasn't answered your question, please contact support.

Related Articles