Search results in PRO

Hi, is there any way that in the search modal when someone performs a search only entries are shown?
And possibly that the search is specifically related to the title of the articles?
Usually when a search is performed, pages and entries are displayed as results.

Thank you in advance!

Hello @ignacioleonrod,

Thanks for writing to us.

Regretfully there is no option for that since the search feature is a core feature of WordPress so we don’t have control over it. In case you want to achieve that feature, I would suggest you please contact a developer who can assist you with your concerns or you can avail Elite where we do custom development. Please note we don’t provide custom development support. It is out of the support scope.

Thanks for understanding

Thank you for your reply. I just wanted to know if there was a way to do it directly from Cornerstone.
I’m leaving the solution here in case anyone else has this question:

You have two options:

1. The one that doesn’t need coding:
Install the plugin named:
Search Exclude by Roman Pronskiy

2. Place the following code into your theme’s functions.php file:

    //Alter the WordPress search to return ONLY posts, no pages
    if (!is_admin()) {
      function search_filter_posts($query) {
        if ($query->is_search) {
      $query->set('post_type', 'post');
    }
      return $query;
    }
      add_filter('pre_get_posts','search_filter_posts');
    }

Hello @ignacioleonrod,

Glad that you were able to get the solution and thank you so much for sharing the information. Please feel free to open a new thread if you have any more concerns.

Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.