pre_get_posts
hook should work for this:
add_action( 'pre_get_posts', 'wpse35832_pre_get_posts' );
function wpse35832_pre_get_posts( $wp ){
if( $wp->query_vars['p'] == 200 ):
$wp->query_vars['p'] = 100;
endif;
return $wp;
}
It may work a bit differently if pretty permalinks are used, different query vars may be set, not sure though.
Related Posts:
- Set global $wp_query/$post variable for dynamic page generation
- Elementor posts custom query based on tag [closed]
- When should you use WP_Query vs query_posts() vs get_posts()?
- Wp get all the sub pages of the parent using wp query
- How to query for most viewed posts and show top 5
- WP_Query vs get_posts
- Hook/action after WP_Query gets posts to query custom tables for post-related meta
- Query Custom Meta Value with Increment
- Get posts by meta data OR title
- Identify which loop you are hooking into; primary or secondary?
- Perform query with meta_value date
- WP_Query ordered by custom field that is a date string?
- Pass the same object to multiple widgets in a template with one query
- Retrieve or Query Pages by ID
- How do you query wordpress posts using a math formula between multiple meta field values?
- How to implement time filter to show random post 1 month for one category and 3 months for other categories
- Page navigation doesn’t show when query category
- How to query a custom post type with a taxonomy filter but display post type archive page?
- Change query_posts to WP_Query in page but does not work
- Custom Query num_rows returns wrong amount
- How to use the query hook/filter?
- Slow page loads due to WordPress Core Query
- Query Page Content From Theme Options?
- Include current post into loop
- Filter post query to only show direct children of category
- Should I reset $wp_query?
- Why doesn’t my WP Meta Query return any results?
- Filter products on category AND tag
- pre_user_query vs pre_get_posts
- Get posts that match defined arrays of tags
- I need query_posts() to order results first by a meta value and then by post ID
- remove_action – pre_get_posts – does not restore original query
- How to show post title in content editor in backend?
- My entry results are not consistently alphabetized
- Merge two queries and remove duplicate
- Ordering Posts by parent category, name ascending
- Optimising specific Query with ACF meta objects
- How to organize a WP_Query’s list of posts by category and display category title?
- When should you use WP_Query vs query_posts() vs get_posts()?
- How to query post ids liked by the Author
- WordPress Query showing multiple titles
- Query Posts by date range with fixed beginning and end
- custom query to get posts
- When to use WP_query(), query_posts() and pre_get_posts
- Is it possible to completely stop WP_Query retrieving posts?
- Make a WP Query search match exactly the search term
- Query WooCommerce orders where meta data does not exist
- RSS feed with specific keyword
- How to know which one is the main query?
- get query’s query string
- Finding all results from database within 500 miles of the given latitude and longitude [closed]
- Show only oldest post by author
- How to get the posts published in last two days using WP_Query?
- Dynamically Override Fancy Title – Part II
- Can not switch the queried post in pre_get_posts hook
- Get the post permalink within the loop but without additional DB query
- List the 5 most recent child pages
- Query total number of posts
- Creating a custom search for a specific post type
- Custom query for sidebar isn’t returning results
- Query last updated posts (posts updated in the last 24 hours)
- new WP_Query(), have_posts() return false in user_register hook
- How to filter, restrict and return posts based on custom user meta information
- Query posts intersecting tags and categories
- WP_Query ignoring tax_query when is_singular
- Different Ways to Query Custom Post Types?
- Query all posts if multiple meta key don’t exist
- Modify Search Query if original Query gave no results
- Is it possible to query from external database? [duplicate]
- Can’t sort custom post type by random
- How to provide meta_key array to wp_query?
- Order post type by sum of two custom fields
- Use WP_Query or query_posts() or get_posts() for optimizing a site?
- How to set up hierarchical relationships without using plugins / meta query
- wordpress udpate query not equal to
- Show single posts date, in a page of posts
- filter posts by meta key with pagination
- Performance concerns: index.php vs taxonomy-$taxonomy.php
- Custom template for password protected page
- WP_Query Class custom field parameters
- meta_query where the meta value is not the post title
- `offset` WP_Query argument dont work via `pre_get_posts`
- Facing problem with tax_query results
- Woocommerce Get Orders By Meta Value
- Move some posts to end of sort order, even if there is a sort in the wp_Query already
- add action for wordpress query at a specific position
- How to query most recent post for each author?
- Is my code correct?
- How to search CPTs in draft using get_page_by_title()
- Meta query doesn’t remove placeholder escape before query
- How can I modify standard search query to include also ACF custom fields values?
- Custom WP_query and integrating into theme file
- How to get query results for the next page
- Loop through multiple custom fields with increasing number
- Need help setting up a search form for wordpress [duplicate]
- query post based on comparison
- Multiple loop for “featured” items returns wrong posts
- Get WP_Query query after execution?
- query_posts problem – need help
- Woocommerce set loop_shop_columns to be 3 in the main shop page loop only and 4 otherwise