Support » Fixing WordPress » pre_get_posts() breaking permalinks

  • Hey guys,

    The exact code is:

    function search_filter($query) {
      if ( !is_admin() && $query->is_main_query() ) {
         $query->set('post_type', array( 'post' ) );
      }
    }
    add_action('pre_get_posts','search_filter');

    This appears to break all of my page links except for one which re-directs to a post for some reason. It happened after updating to 3.8 although i guess the code could be wrong too. Any help would be much appreciated!

    Thanks

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘pre_get_posts() breaking permalinks’ is closed to new replies.