Support

Account

Home Forums General Issues Include in search, and remove result limit (10)?

Solved

Include in search, and remove result limit (10)?

  • Again facing the crappy bunch of code WordPress really is, I’m struggling to find a solution to add categories (of custom post types with ACF) in my search result while removing the limit (of 10) in the result?

    Anyone got any ideas? This should be a simple tick of checkboxes somewhere in the settings, but oh no – you have to write a bunch of hacks on top of the already gigantic pile of poo that WordPress is (sorry for the rant parts, I’m continuously totally frustrated with WP on second decade … ).

    I was looking for ‘posts_per_page’ in relation to the search functionality, but couldn’t find it (found 165 matches spread across 76 files – and simply cannot figure out which one to alter. And how).

  • In order to modify the results of a search you need to modify the search query and this is done using a pre_get_posts filter https://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts

  • Thanks John, managed to get this working using a plugin and the pre_get_posts filter. But man, does one spend time googling stuff …

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

The topic ‘Include in search, and remove result limit (10)?’ is closed to new replies.