Home › Forums › General Issues › Issues with pre_get_posts() and get_field() › Reply To: Issues with pre_get_posts() and get_field()
The problem is that your changes to the query are effecting every query, including those to get attachments, fields, field groups, anything that is appearing on the home page. You need to narrow down what you are applying this to more than you have.
For example, if this is to alter the query that shows the archive list of “Posts” in order to add “Tweets” then you should check to make sure that the post type being queried is in fact “post”
for example:
if ( !is_admin() && is_home() &&
isset($wp_query->query_vars['post_type'] &&
$wp_query->query_vars['post_type'] == 'post') {
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.