1. Home
  2. Knowledge Base
  3. Posts Table Pro
  4. 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, please refer our article about how to use code snippets for guidance:

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' );

Related Articles

If searching the knowledge base hasn't answered your question, please contact support.