• Resolved wprun

    (@wordpressrun)


    Is this plugin supposed to hide from the search in the:
    – frontend?
    – backend?
    – or both?

Viewing 2 replies - 1 through 2 (of 2 total)
  • I am also wondering about this. I want to exclude from search on the frontend but not the backend. Currently, pages and posts are being excluded from backend search on WP, which is not what I want. How do I fix this?

    Plugin Author quadlayers

    (@quadlayers)

    Hello @wordpressrun @susisheridan

    The plugin hides from search in both

    You change this behaviour modifying the filter

    add_filter( 'pre_get_posts', array( $this, 'search_filter' ) );
    
    public function search_filter( $query ) {
    
    $exclude =
    
    ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) )
    
    && $query->is_search
    
    && ! $this->is_bbpress( $query );
    
    $exclude = apply_filters( 'searchexclude_filter_search', $exclude, $query );
    
    if ( $exclude ) {
    
    $query->set( 'post__not_in', array_merge( array(), $this->get_excluded() ) );
    
    }
    
    return $query;
    
    }

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Hiding from Frontend or Backend search’ is closed to new replies.