This topic has 6 replies, 2 voices, and was last updated 9 years by viadsworld.

  • Author
  • #65192
     viadsworld
    Participant

    Hi,

    I would also love to limit my search results to products, members, post and if easily specific pages specific pages.

    or

    How can I remove pages from search results entirely?

    Returning results display 404, contact and other template pages in the results, which is confusing and a risk.

    How can I make this changes asap.

    appreciation in advance.

    #65193
     viadsworld
    Participant

    screenshot

    Attachments:
    You must be logged in to view attached files.
    #65232
     sharmstr
    Moderator

    Try this in your childs functions.php file. Change 30 and 1081 to the page ids you want to exclude.

    COPY CODE
    
    function exclude_single_posts_home($query) {
      if ($query->is_main_query()) {
        $query->set('post__not_in', array(30,1081));
      }
    }
    
    add_action('pre_get_posts', 'exclude_single_posts_home');
    
    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #69708
     viadsworld
    Participant

    sorry just created a nother post for this topic I forgot we post this question.

    How can we remove all pages from search results?

    #69774
     sharmstr
    Moderator

    This is not Kleo specific. Googling came up with these possiblities

    https://wordpress.org/plugins/search-exclude/
    http://www.wpbeginner.com/wp-tutorials/how-to-exclude-pages-from-wordpress-search-results/
    http://wordpress.stackexchange.com/questions/142811/exclude-pages-from-wordpress-search-result-page

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #77484
     viadsworld
    Participant

    Thanks this worked!

    #77490
     viadsworld
    Participant

    actually theres was one issue – even though this removes pages from search. it also removes page from the site all together, even on the admin side.

Viewing 7 posts - 1 through 7 (of 7 total)

The forum ‘KLEO’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?