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
- Modify WordPress Search
- Using OR conditions in meta_query for query_posts argument
- What is the most efficient way of querying posts based on visits and date for current day?
- Get posts by menu ID
- Meta Query with date and time on the same Day before given time
- Order posts by tags count?
- Add and in the header while looping over custom query in page template
- Which custom query am I in and how can I access its properties & methods?
- Display different number of posts from one category on the different pages
- How to speed up wp_query, took more 5s to run against 100k posts
- Including only current user’s posts in search
- Exclude posts with empty post_content in wp_query
- Custom category search box for WordPress
- Minimize database queries to user tables?
- Query with a meta value inside a given range
- Query all published post AND attachment with specific mime type
- Get all products which have both product category
- unable to retrive parent page information
- How to display user order by role
- WP Query related posts by tags
- Order by summing multiple values
- How to display an other custom post type in a different custom post type’s archive?
- Is there a reason why Pages are not publicly_queryable?
- Check return value of get_posts
- Exclude some authors from query
- pre_get_posts – Trying to get property of non-object warning
- WordPress query posts with multiple post_meta data
- complex get_posts() query to select child pages
- Update query for wp_posts and wp_postmeta
- Insert images into wordpress post with a query
- WP_Query meta compare must include ALL array values
- How to query for a page, get data, then query for child pages of that page
- WP_Query retuning empty array in rest api
- Query post ordered by meta value that show first post that contained a tag
- Adding nofollow to all the post links in get_posts with pre_get_posts or WP_Query
- Meta query orderby meta_value_num sorting by role first
- Add to search posts query array with post IDS which will appear first
- How to show terms from another taxonomy
- How to order posts, that have already been filtered by custom taxonomy, by their category names?
- Ignoring ‘a’ when sorting posts
- WP Query Relations / Compare
- How to order by datediff in WP loop?
- Custom query for tag and custom tag from 2 post type
- WP_Query secondary query failing
- Search Functionality broken by the wp 4.2 update
- Issue attempting a wp_query_posts with tags
- Why I obtain this WP_Query strange behavior trying to select posts having a specific tag?
- add_query_vars does not work
- Retrieve posts in custom post type and specific taxonomies
- Get the number of rows from $wpdb->get_results not working
- Get Child Custom Post Content on Single.php?
- Exclude categories and subcategories in QueryLoop
- How much does $wpdb->prepare(), then $wpdb->query() VS straight $wpdb->query(), can slow down the load time of whole page
- Pre_get_post on CPT archive page
- Get posts that were most recently tagged
- How to get posts that have certain meta key value and order based on another meta key’s value
- Adding a language rule and displaying posts with a custom taxonomy term on its archive page