I think the WP function you are looking for is add_rewrite_tag. It aims to add custom GET params to your URL and include it automatically in query_vars
.
For example, you can add the following to the init hook :
add_rewrite_tag('%person%','([^&]+)');
For a url like http://example.com?person=joe, the global $wp_query
will have
$wp_query->query_vars['person'] = 'joe'
You can also add a rewrite rule to make the URL prettier, for example http://example.com/person/joe
add_rewrite_rule('^person/([^/]*)/?','index.php?person=$matches[1]','top');
See the Rewrite API for more information and examples.
Related Posts:
- How to merge two queries together
- Usage of the new “posts_clauses” filter in WordPress 3.1?
- WP_Query orderby one custom field then another in one query
- Pagination on a WP_query not showing navigation links
- switch_to_blog() performance considerations & alternatives
- Is it possible to select against a post’s parent’s fields with WP_Query?
- What’s the best approach for showing posts by A->Z order?
- Load more AJAX on WP Query
- page was loaded over HTTPS, but requested an insecure image
- WP_Query: How do I sort on meta value and use LEFT JOIN?
- How to pass custom parameter to WP_Query for filtering in pre_get_posts
- WooCommerce: filter by parent product’s taxonomy and product variation’s meta data
- How to search by title or tags exclusively?
- Paginated pages are showing correct content but pagination links are not
- Query Posts but only return 1 from a custom taxonomy?
- Loop inside the loop
- WordPress search exact match
- How to count post type that has a particular term?
- What is the difference between RELATION “AND” and “OR” in TAX_QUERY?
- Query Set Order By Author
- ‘&’ causes an error in my shortcode when I list the content of the page
- wp_query, give first post different formatting
- Best practice custom function, where to echo the variables?
- meta_query works locally but not on live server
- getting posts and number by specific meta value in multiple meta
- How can I pick a single post from the latest 3?
- Retrieving list of a custom post type in a widget without using WP_Query?
- How to orderby meta_value_num with dollar ($) sign
- Order WP_Query by multiple fields, subtracting them from one another
- How can I convert results of WP_Query (of Custom Post Type, with Custom Fields) to JavaScript?
- Query with custom taxonomy not working
- How to order posts in wp_query by the user role (2 roles in array)
- getting post thumbnail within loop causes an error
- Reset postdata to custom query in nested queries
- How to change main query based on post meta
- Hide Administrators From User List except current user (administrator)
- Custom Query num_rows returns wrong amount
- How to figure out redirection and contents in hybrid solution containing word press content and legacy code (ASP.net)
- Category applied to pages, creates multiple breadcrumb entries after a search query (On the translated site)
- Most commented post showing 2 records
- Loop Split two Columns
- Search by post id in a specific page then auto-redirect to searched post
- Pretty urls for custom pagination
- Add posts to WP Query object
- use of 10 new WP_Query : loading too slow (with url) [closed]
- How to make a second query offset -2 from current post
- How to not display tags with less than X posts
- Order or Orderby in tax_query (How to define order of terms in WP_Query)
- Wp_query with 2 meta keys and array of meta values
- How to exclude Sticky from Recent Post?
- Create a loop on my pages with new “WP_Query”
- Which meta_query and post_content blend is better in WP_Query, performance wise?
- get_query_var always returns the default value
- WP ForLoop to compare meta information of posts to determine what post to display
- Problem with get_page_by_path() using with WP_Query
- Query where ANDing slug values not working
- Modify WP_Query using pre_get_posts but only for frontend query?
- Multiple wp_query on archive page
- change posts_orderby of the callback wp_query?
- Retrieve select tag custom values from array and display them in current page with wp_query?
- parse_tax_query causing Navigation Menu To Disappear
- WP_query is not returning the expected result
- show custom category posts from a custom post type
- how to load posts to a custom post template after using template_redirect or template_include
- the_post_thumbnail do 2 queries. How to optimize
- wp query meta value is not null
- Trying to use WP_Query to display a custom post type
- WP Query / Meta Query [duplicate]
- WP_Query and pagination AGAIN?
- Can’t get term id for category archive
- Query multiple post types, but different order for each
- Nearby locations using Advanced custom fields, maps?
- View list of custom posts within a date range relative to today’s date, based on a custom date field
- How to display the category dropdown auto search list when key press?
- order by post date and modified date posts both in wpquery
- Comparing Meta Field date in WPQuery using Meta_Query?
- Fix wp_term_relationships slow query in get_posts
- How to get_comments() ordered by date and parent?
- How to search posts by title with special characters in WP_Query?
- WP Query filters active on wrong query
- Not able to fetch woocommerce variation sales products for particular category products
- Global page ID variable empty error
- Query postmeta based on meta_value, return array of post_id
- WP_Query: Query posts only if their access is restricted to logged user’s role
- datetime picker, timestamps and meta queries
- Meta key in wp_query bug?
- display all posts from category with and without terms in chronological order
- WP Query with sticky posts and tax_query
- How can I create another instance of my custom shortcode
- How To Call WP_Query From A Subdomain?
- Extending WP Query: Custom geolocation meta values work, but tax_query breaks
- WP_Query for attachments without duplicating post_parent and displaying tagged image
- Show sticky post before other WP_Query
- Post OrderBy slow performance
- Query posts by custom fields
- Showing posts from 4 categories along with all latest posts
- Searching in specific custom post type
- WordPress pagination returns the same posts
- WordPress extremely slow when using get_posts with multiple meta_query relations
- Search results stuck on page 1