How create a WP Query that ignores pre_get_posts
-
DESCRIPTION
I currently have a website, with a number of custom post types that allows the user to change the number of posts that appear on each custom post archive page independently (via the Theme Customizer).In order to make the pagination work properly, I needed to apply these posts_per_page variable inside a function that hooks onto pre_get_posts.
PROBLEM
The problem I have is that each custom post archive page has 2 separate loops:- The main loop which I want to allow the user to able to change the number of posts per page
- A Featured loop which appears at the top of each page which has a fixed number of posts per page
I want the featured loop to only have 8 posts per page, but the posts per page query for this loop is being overwrote by the pre_get_posts action (I know this is because pre_get_posts applies the arguments before the query is run).
Is there any argument or functionality that will force a custom wp_query to ignore the pre_get_posts action?
I appreciate any help or suggestions you many have.
- The topic ‘How create a WP Query that ignores pre_get_posts’ is closed to new replies.