Support

Account

Home Forums General Issues Solved issue, but would like an explanation Reply To: Solved issue, but would like an explanation

  • The reason is that your code appears to be modifying every query, your code will also modify any query made by acf or any other plugin or theme code. What you need to do is be more specific about what query you want to alter.

    
    // only modify the main query
    if ($query->is_main_query()) {
      // modify query
    }
    
    // only modify queries on a specific post type
    if (isset($query->query_vars['post_type']) &&
        $query->query_vars['post_type'] == 'post-type-slug') {
      // modify query
    }