Home › Forums › Front-end Issues › Top menu disapears in Category Pages when filtering using ACF › Reply To: Top menu disapears in Category Pages when filtering using ACF
Hi @uakz
Your pre_get_posts
filter has the potential to affect every WP_Query on the page! This would explain why your top menu is not returning the correct data.
Looking at the WP docs: http://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts it seems that another validation is done in the filter to make sure this is the main
query on the page:
if ( !is_admin() && $query->is_main_query() ) {
So you could add another line to the top of your filter like this:
// validate if( !$query->is_main_query() ) { return; }
hope that helps
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!
🚨 The 2023 ACF Annual Survey closes tomorrow! This is your last chance to complete the survey and help guide the evolution of ACF. https://t.co/0cgr9ZFOJ5
— Advanced Custom Fields (@wp_acf) May 18, 2023
© 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.