First, you register your query vars param1
and param2
:
function wpse_101951_query_vars( $qv ) {
$qv[] = 'param1';
$qv[] = 'param2';
return $qv;
}
add_filter( 'query_vars', 'wpse_101951_query_vars' );
To use this information, you can pretty much hook into any action or filter after parse_query
. That’s the first action available after the query vars are set, so it’s the first action where you can use get_query_var. Here’s an example:
function wpse_101951_get_params() {
if ( $param1 = get_query_var( 'param1' ) ) {
# Do something as a result of param1 being set
}
if ( $param2 = get_query_var( 'param2' ) ) {
# Do something as a result of param2 being set
}
}
add_action( 'parse_query', 'wpse_101951_get_params' );
Related Posts:
- Why “?v=hash” is added to my URLs? [closed]
- use query string in URL to display content on the page
- Pulling a parameter out of the URL of a WP link without “?” or being sent to a different page
- Dynamically change page title from URL param
- 404 error when passing “cat” parameter to URL
- How to add URL-Parameter for Javascript Widgets?
- HTTP 403 Error when passing parameters to URL
- WordPress get parameter ‘unapproved’ and ‘moderation-hash’
- Passing values through url for checkbox fields with same name to get?
- Custom HTML title based on URL parameter
- How to get a page url segment on wordpress?
- Different url to same page (with dynamic content)
- Add a paramter to page url
- Why “?v=hash” is added to my URLs? [closed]
- Add more than one query parameter onto wordpress url
- Set A Cookie To URL Parameter, Pass Cookie From Page To Page To Alter Post
- Use URL parameter to create dynamic content
- Pass post title as URL parameter
- How to pass parameters thru URL?
- Duplicate pages with ?s parameter
- How to use query string in URL to display content on the wordpress page
- help me remove this additional parameter in url
- Problem with guids and absolute links
- How to remove “http://” When Echoing URL?
- WPML Get url without outputting
- Weird: /?name in URL leads to blog
- I am Looking to append URL Parameter to all URLs
- Is dynamic URL possible in WordPress
- Accessing the Current URL in a Text Widget for a Facebook Share Button?
- Is ‘name’ a reserved word in URL’s?
- How to create a custom page base on URL for WordPress?
- How to make menu items active based on hash
- Use image url with add_image_size
- Multiple domain names for one site
- How to always rewrite author archive page URL even if the author does not have a post
- Special domain for a page
- How to delete unused URL?
- urlencode query string in gravity forms confirmation redirect
- How to server wordpress from SSL and non-SSL URLs
- Author Nickname URL Friendly
- Moving a test WP site to live
- How do I write the link from front-page.php to home.php?
- Should I set the html base url when using wordpress?
- how to make URL link query string
- How do I test my localhost WordPress project with VirtualBoxVM?
- How do I link to a blog not set as the homepage?
- Updating URLs in many posts
- Problem with change url for all subpages (.htaccess)
- Displaying Post with Custom URL with RewriteRule or add_rewrite_rule
- Is there a link parameter that will show me all my published pages?
- Save URL into database
- How to get URL for the first page of post archive
- Imported 10 000+ posts, custom field showing link not displayed
- Newline URL entity when using esc_url()
- How to auto gen. custom post type values in other custom post type in url?
- previous_posts_link and next_posts_link, how to return the next/previous post’s title as the url
- Get Top parent url
- hide wp-content from urls
- Changing the website URL to the root folder
- URL issue after migrating to dev site
- Renamed my website (URL) – how do I rename all within-page links to the old URL?
- Moving a WordPress site – Installation issue
- Organizing the Navigation Menu
- My #id is not showing in the url when the user clicks on the anchor tag
- What php gets called for home_url/somepage URL?
- How to create custom search result page with custom URL parameters for custom post type?
- Use wp_redirect to add a parameter
- Extracting a variable from a permalink
- After changing the site root, how to reflect this for wp-admin too?
- How can I prepopulate the URL address for the add media button
- How to show Specific URL of WordPress on Any one Specific IP only?
- How rewriting a url to make it SEO friendly
- How to make a seo friendly URL of 2 different pages with same words
- Mapping a domain name
- No https in url when writing links like:
- How to construct a dynamic rewrite rule for child pages that passes more than one query var
- Why my URL has an unknown character string?
- WordPress inserting ?q= in URLs
- Set URL Parameter Post Layout As Default
- Embed ACF URL Field in WP title field
- Getting Turkish alphabet characters in the URL field in webbrowser
- Post not redirecting to non www after changing from www
- Generate new URL for popup form
- How to properly setup MAMP and XIP
- URLs fine in database but wrong in output
- Cannot access to dashboard on localhost
- My website has some Crawling Errors?
- How can I modify the ‘Insert/edit link’ option to offer root-relative urls?
- How to set global variable in functions.php
- Why am I seeing ‘yes’ and ‘no’ in URLs crawled by Xenu?
- bloginfo no show the right path
- URL with without www shows just a blank page
- How to create custom authors links
- Using functions concatenated with strings inside a variable
- After site transfer I’m still getting redirected to the old site (WordPress)
- How to generate external url in WordPress
- apply styling only to a specific url
- URL, which automatically close tab
- How can I implement an Article Wizard for non-existing URLs? [closed]
- What purpose does /embed/ URL have and how to avoid SEO problems?