Support » Plugin: Simple Staff List » Search Function

  • mikebou


    I would like to have a search function with this plugin.
    Have you any code that would help with this?

Viewing 1 replies (of 1 total)
  • Plugin Author Brett Shumaker


    Hi @mikebou

    To add custom post types (like the staff-member post type used in this plugin) to search results, you’ll need to add a filter to pre_get_posts that adds that post type to the search queries.

    Added to your theme’s functions.php file, something like this should work:

    function sslp_support_add_staff_members_to_search_query( $query ) {
    if ( $query->is_search && !is_admin() ) {
    $query->set( 'post_type',

    return $query;
    add_filter( 'pre_get_posts', 'sslp_support_add_staff_members_to_search_query' );

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.