First off, these aren’t CGI variables, they’re query string arguments.
WordPress, by default, will remove any query arguments that it doesn’t recognize. So you need to register them with WordPress and then pull them back out of the query.
First, add your new query variable:
function wpa_48528_vars( $vars ) {
$vars[] = 'filter';
return $vars;
}
add_filter( 'query_vars', 'wpa_48528_vars' );
Now, get the data back out:
function wpa_48528_get_filter() {
global $wp_query;
if ( array_key_exists( 'filter', $wp_query->query_vars ) ) {
return $wp_query->query_vars['filter'];
}
return '';
}
Related Posts:
- How to set global variable in functions.php
- Extracting a variable from a permalink
- How to make url variable?
- How to set global variable in functions.php
- Difference between esc_url() and esc_url_raw()
- Pulling a parameter out of the URL of a WP link without “?” or being sent to a different page
- Run WordPress frontend and backend in different domains
- Can’t login after my site was moved to a new server
- Adding a hook to ‘parse_request’ so that siteurl/pagename/xyz ignores “xyz”
- How to have numeric URLs in Posts and Pages
- Why WordPress automatically removes http from the url of my website’s sub domain?
- WordPress Move to SSL How to Update Media Assets to HTTPS?
- Moving wp-content outside of web root?
- Generate one time URL
- In Settings>>General I am missing some fields
- Adding target and _blank as it’s value to the allowedtags
- permalink for category pages and posts
- Get url from file uploaded in Media Library
- Allow UTF-8 characters in the user slug part of URL
- WordPress converting ../url to http://../url
- home_url(); showing current page instead of site address
- URL parsing – what is it?
- Components used in Themes and Plugins: How to get file URL?
- Can URL remain the same if migrating from Drupal?
- Site URL always in front of other URLs
- How to add domain security certification, in WordPress website?
- Imported thumbnails have incorrect URL
- Is it necessary to check for `content-type` in headers?
- How to allow — in category name
- Request parameters in $_GET do not match URL called
- WordPress custom search url
- The requested URL was not found only on localhost
- Allow Chinese character on post URL slug
- How can I change a media attachment URL/slug, so that I can use that slug for a page?
- Problem with utf8 link
- remove query string from homepage url
- Twitter shortlink 404 not found [closed]
- Remove Trailing Slash from Category Base and Tag Base
- Custom url in wordpress
- WP URL /icons returns 403 forbidden error
- Get root folder without domain
- wordpress.com website url structure [closed]
- HTTP 403 Error when passing parameters to URL
- How to remove my website link when adding a link?
- Misentered the site address url. How to recover? [closed]
- How to make pages slug have priority over any category
- How to call for bloginfo inside function in functions.php?
- Website Address Keep redirect to website after migration attempt
- What is the best way to figure out which template file that a “pretty permalink” is using?
- Can’t change the wordpress site url
- Wrapping add_query_arg with esc_url not working
- Relative URLs within site
- Using WordPress for a site’s static marketing pages and blog at different URLs
- What is the best way to revert to www version of domain name?
- Need to check if user is on a particular page
- How to set path to the image instead of alt in media.php?
- Go back to my home page
- Changed domain name and all the 301 redirects work except the ones for the thumbnail image which return 403 Forbidden error
- Changing url of author page
- How to get previous and Next Post Url in the_post_navigation
- Thousands of unwanted URLs/pages with “0” in slug created
- How to remove % character from url
- Can non-latin characters appear in slugs?
- Encode URL for WhatsApp “click to chat” without loosing accented characters
- append currency to URL
- Create 600 links to separate files on google drive
- Locked myself out of WordPress because I changed my URL and computer shut down
- Cant access my wordpress.org locally
- I changed the URL [closed]
- WP site homepage displays url link at beginning of each featured post
- how to set url in admin option page
- Unable to login after changing WordPress site url
- Why is my WordPress URL shortened
- mysterious issue with stop words in urls not working – how can I restore multiple url access?
- What does this structure of the URL mean? http://www.example.com/?i=0
- Private Messages between users
- Using ACF Custom Field value in a URL with do_shortcode() [closed]
- Navigation and Permalink not getting correctly
- How can I display a specific number of post in a category via a url
- How to create a dedicated folder for specific role via registration
- How to get the correct URL on my wordpress site?
- WordPress custom form post to different page
- Two domain site: Link base URLs point to wrong domain
- How to redirect WP post with a specific word in the URL
- Duplicate content with the same URL, google authorship
- Making a site URL
- Avoid too long words in a post title, post content or comment but only if its not a url
- Change URL to filter posts
- My class function is not seeing GET url paramaters
- Modify WordPress to not replace + (plus) characters from URLs?
- How to remove slug from url (custom post type)
- Enabling canonical links to force search engines to go to site.com rather than site.net [closed]
- Why my wordpress site URL does not begin with my domain?
- Is There a Way to Schedule URL to Content Updates?
- I changed my url and cant access my site, Help?
- Accidentally changed the url
- Select Tab name to show in browser’s URL
- Where can I add list of external URL for WP ADD link tool?
- WordPress page URL: Get rid of /wp-content/… part from URL
- How to create multiple urls for a same page contents in wordpress