Home › Forums › General Issues › Trouble filter query on acf checkbox value and $paged › Reply To: Trouble filter query on acf checkbox value and $paged
The first problem with your code is that you specified the pagination for the main query, not the custom query (
$query = new WP_Query( $args );). This code will always show a different page number even if you have the right custom query.
Secondly, you manually hide the content by checking the custom field instead of filtering it from the custom query. This code will never show the right page number because your custom query doesn’t know that you hide certain contents after the query is initialized.
To learn how to show pagination with a custom query, please take a look at this page: http://callmenick.com/post/custom-wordpress-loop-with-pagination.
With the method described in that page, your first code is the closest one. Could you please share your JSON or XML export of your field group so I can check the query for you?
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!
© 2023 Advanced Custom Fields.