Only show blog posts on search result page

  • Unknown's avatar

    Hi, I work on a website for my client. I want the search results to only search for blog posts. Now, it searches for pags, products and blog posts… Here is the site https://velbehagklinikk.no/blogg/ I want to fix. I have trid to use the searxh exclude plugin, but my client have 300 products, so I don`t want to use so much time to exclude every product manually. Is there a better way to just only show blog posts?

  • Hi there,

    You should be able to use either a plugin or a custom PHP filter to restrict search results to only the Post content type.

    If you’re already using a Search plugin on the site, I recommend you contact support for that plugin directly to make sure if they have a setting for that.

    You can also consider Jetpack Search – that adds Jetpack’s search feature to your site instead of the built-in WordPress search feature, and Jetpack Search comes with a number of filters already built in:

    Jetpack

    Just note that while the Jetpack plugin is free, the Search feature is a paid service.

    Otherwise, you can try asking in the WordPress.org forums for help with a custom PHP snippet to add a filter like this to the built-in search:

    https://wordpress.org/support/forums/

    (The forum you’re posting to now is for the hosting provider, WordPress.com, not the WordPress software you’re using, so our ability to help here is limited :) )

  • Unknown's avatar

    Thanks!

  • The topic ‘Only show blog posts on search result page’ is closed to new replies.