First, year
is already a WordPress query var used for date-based archives, you should change that to something unique to prevent possible conflicts.
To use your own query vars within rewrite rules, you need to add them to the list of known vars:
function wpd_query_vars( $qvars ) {
$qvars[] = 'my_year';
$qvars[] = 'make';
$qvars[] = 'model';
return $qvars;
}
add_filter( 'query_vars', 'wpd_query_vars' , 10, 1 );
Then you can output their values in the template with get_query_var
:
echo get_query_var( 'model' );
Related Posts:
- How can I modify the permalink via a filter?
- Change links automatically to affiliate links
- Add .htm extention to a custom taxonomy
- How to define a rule in functions.php that ONLY disables the default wp functionality that undesirably changes ‘&’ to ‘#038;’?
- How to create “page” used for generating PDF? [closed]
- Why isn’t my custom function kicking in from my functions.php file?
- WordPress adding in site URL to header links
- Removing Default Gutenberg Blocks, But Keeping Reusable Block Functionality?
- Add Useragent to the body class?
- How to override an unpluggable parent theme function?
- Remove wp-mediaelement.css from wp_head
- add_filter to post-gallery and remove all ‘s?
- Set the transport of the Customizer ‘header_image’ core setting to ‘postMessage’
- Can i check if user is doing any ajax request?
- delete an array element when its date expires
- Understanding WordPress child theme custom JS loading
- Disable External Pingacks on WordPress Posts and Only Allow ‘Self Pings’
- javaScript in section of WP API
- WordPress Redirect: Default Password Reset URL [duplicate]
- Removing unneccessary p-tags (Not every p)
- How to rewrite URL with PHP variables with htaccess to a normal looking URL?
- Create another “Display Site Title and Tagline” checkbox, “Header Text Color” setting and control
- How to remove or change the “W” icon in “My Sites”?
- Is sanitize_title_with_dashes formatting function too liberal (in terms of accepted characters)?
- How to add seperate classes to no-search-result and found-search-result pages on wordrpess search – is_search()
- wp_trim_words() does not work with my code Am I doing any mistake in my code?
- Woocommerce: hook action/filter I could use to add variation id and price with each attribute opt on WooCommerce Rest api
- Firing schema via code in functions.php doesn’t work
- A non-numeric value encountered in /wp-includes/functions.php on line 68
- WordPress Persistent connection rule does not work for “posts”
- getting logged in user info (wp-load.php) from parent directory
- Blog posts repeat
- Ajax load more button for comments wordpress
- Update user profile information from functions.php
- Custom gallery in wp3.5
- How can I modify footer when footer.php calls to another file?
- How to fix this warning:call_user_func_array() expects exactly 2 parameters, 1 given in D:\wamp\www\…….\wp-includes\class-wp-hook.php on line 286
- How to set the WordPress logo programmatically with PHP
- How to use theme function in post/page?
- esc_url( ) won’t use https
- Function won’t run onclick using Ajax
- Add login hyperlink to secondary navigation menu
- Where is this function’s callback getting its arguments from?
- Warning: in_array() null given in PHP function
- Use post ID in functions.php file adminside
- How to: Conditionally Enqueue JS and Stylesheets, for Custom Post Type (Single and Archive Templates)
- List all blogs, but exclude the main site
- How can I count ACF sub_field with a certain value
- change the default order of posts only for specific categories
- Reading settings in the home page precisely home.php
- Problem with adding custom CSS class to image in ACF Photo Gallery plugin [closed]
- How do i add slugs to a URL, but still redirecting to the same page
- Calling function in loop causes repeat data
- Custom posts password protect
- How to get post category list as select in front-end?
- How to use functions [closed]
- Splitting the_content() by size?
- Is there a hack for using is_page() within the function.php file?
- Add a select-option to the default widgets
- Function to call either single post or category
- Updating Metadata with Shortcode
- can’t load .po file in functions.php
- WP-Bakery – Add custom colors to buttons with template colors
- Woocommerce – Exclude variation attribute on specific variation
- How do I add a function to parent theme
- Are there any drawbacks on opening a session_start in functions.php and header.php?
- Create shortcode for metabox gallery
- Show all people who commented on all posts by an author
- Add Pre-Defined Value to Click Counter in WordPress
- How can I redefine WordPress wp-content directory programmatically?
- Trim Titles Only On Some Pages
- Custom global variable not working in function
- Show data obtained from a function and place it in a shortocode function
- get_the_author_meta( ‘ID’ ) just return 1
- How to override theme’s public static function inside of a trait?
- Delete empty title_tags, find a h1 heading and echo it
- Enqueue sripts and styles only if function is called
- Site title not showing. Please help me
- Check if post visited first time
- WP_Query To Display Product Of Brand On Taxonomy Page
- ajaxurl usage for a custom function
- Store custom field’s multiple values in one user meta key
- oembed facebook link?
- Open/closed function [closed]
- Need to Echo A Url path to show on a wordpress page
- Search for images that width and height is more than 500
- add a value to an external link query in searchform
- wordpress ajax return 0
- My customizer’s setting doesn’t set to the default and needed to click the control’s “Default” button before it’ll be set
- site_url() returns with additional backslashes
- How to have Function of a plugin using global vars into a shortcode?
- adsense code showing on random post thumb
- How can I clear the theme mod settings?
- Cant get theme to change footer color through theme customizer
- How to extend the page editor?
- Get permalink for a post from inside WordPress and route to a related site
- ACF Date fileds to Age Convert [closed]
- I need a button to appear when not loged in and another when logged in, I need help fixing code PLEASE!
- How to hide .js files on wordpress website using php or wp plugins or any? [closed]
- WP Custom tables query