Home › Forums › General Issues › Image field returns ID, not Array, when filtering › Reply To: Image field returns ID, not Array, when filtering
Well, the pre_get_posts filter you have is probably interfering with other queries. What you need to do is to limit it more.
Instead of just checking to see if it’s the admin do something like
if (is_admin() || !$query->is_main_query()) {
// limit to only the main query
return;
}
You may also need to do further limiting, for example limiting it to a specific post type
if (!isset($query->query_vars['post_type']) ||
$query->query_vars['post_type'] != 'post') {
return;
}
the code examples given here are meant for reference and simple examples and may not be everything you need.
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!
📣 “ACF Chat Fridays”
— Advanced Custom Fields (@wp_acf) January 31, 2023
The ACF team holds their first open office hours this Friday! Come and talk ACF, and ask questions about building sites with the plugin.
We’d love to see you there!
📆 Friday 3rd Feb - 3pm UTC
👉 Register here - https://t.co/3UtvQbE4CU pic.twitter.com/oTwW9K1XQ0
© 2023 Advanced Custom Fields.
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.