First of all, you have to make sure to register your public query vars with WordPress so it recognizes your rewrite rule vars.
Add this code on your functions.php file:
add_rewrite_rule('^(tips)/([^/]*)/([^/]*)/?', 'index.php?name=$matches[1]&id=$matches[2]&filter_id=$matches[3]','top');
add_filter('query_vars', 'foo_my_query_vars');
function foo_my_query_vars($vars){
$vars[] = 'id';
$vars[] = 'filter_id';
return $vars;
}
After that, enter on your Permalinks Settings page to flush your permalinks, just save it again and WordPress system will rewrite the .htaccess file.
You can access your variables as follows:
$id = get_query_var('id');
$filter_id = get_query_var('filter_id');
This rewrite_rule works only for level/cat/1 (1 being the filter_id).
Related Posts:
- A tool to analyze rewrite rules? [closed]
- Making a plugin file accessible via url rewrite?
- How to Rewrite WordPress URL for a Plugin
- Custom Rewriting to Plugin with Parameters
- Filter to change the content of 404 page
- Add rewrite rule in plugin: with .htaccess in plugin folder or using WordPress functions
- Removing rules from .htaccess
- Mapping multiple URLs to same page
- Rewrite Point Doesn’t Work on Custom Taxonomy
- Rewrite url for existing page without flush_rewrite_rules
- Custom rewrite rule serves content, but returns 404 error code
- URL rewriting must be activated manually for my plugin
- How to change the URL pattern for single post view
- Why doesn’t flush_rewrite_rules run on plugin activation?
- Redirect traffic to plugin
- Append country to ‘pretty’ url but serve same page
- How To Consistently Enforce Rewrite Rule in Plugin Development
- How can I rewrite a URL to pass requests to a custom method via AJAX? (I can’t use admin-ajax.php)
- Adding rewrite rule dynamically
- rewrite URL based on selected taxonomy for post page
- Remove custom post type slug from URL and add taxonomy Slug
- Help writing custom function with rewrite endpoint that generates a page from dynamic content
- Possible to get all posts with my shortcode?
- add_rewrite_rule behaving strangely
- HowTo to add my rewrite rules at the beginning, redirect to the right page and flush the rules on plugin activation?
- Create page (not the post type) dynamically
- How can I add rewrite rules to a class-based plugin?
- configuration of .htaccess for add_rewrite_rule to make sense
- Plugin Development – Get Admin Url (Including cases where wp-admin is not used)
- Forward an old url rewrite scheme to a new one?
- Rewriting Image URLs from dynamic to original
- Custom Path for a Plugin
- Custom post type change permalink query
- Change cannonical URL after changing url with add_rewrite_rule()
- Disabling Yoast, All-in-One, and Rank Math on Certain Pages within a Plugin
- WordPress custom url without using any of the custom tags given
- Using meta_key & meta_value in add_rewrite_rule
- How to force download a plugin generated file?
- How to pass a more variable with page/subpage in Wordprees URL?
- Any way to make Apache’s internal redirect work?
- How can I send an id over the url?
- Custom slug in url for CPT and taxonomy
- add_rewrite_rule not working
- Mapping multiple URLs to same page
- Use custom clean URLs for a plug in
- How to Rewrite WordPress URL for a Plugin
- Virtual Page with Registration form
- How to use permalink query to go to specific tabs in posts
- How to Rewrite WordPress URL for a Plugin
- redirect word-press page with page values
- URL rewrite parameter lost (add_rewrite_rule)
- Custom rewrite, url path with parameters to a page
- Change default admin page for specific role(s)
- Check for dependent plugin and if false dont activate plugin
- Show message on wordpress admin dashboard
- Log in from one wordpress website to another wordpress website
- How is the data stored in the database?
- How to prevent loading of all plugin’s resources?
- Unit Testing a Plugin functionality with cron
- Is it possible for a plugin to register a page template file?
- Error “Call to a member function switch_to_locale() on null” during insert_with_markers
- multiple functions with same filter
- call_user_func_array() expects parameter 1 to be a valid callback, array must have exactly two members
- How to Create Custom HTML Tag on Editor in `Text(HTML)` mode
- null callback in add_settings_section
- Is there a Filter that I can use to filter the tags before they are inserted in to the database?
- How can I pass get_the_author_meta(‘user_email’) through the REST API?
- Show error, when selecting image in WordPress media uploader if params mismatch
- How can I identify it as admin page or not?
- AJAX form post returns 0
- Adding admin menus to wordpress
- Update custom plugin with WP-CLI
- Autogenerate a Table of Contents
- Update wordpress Core Remotely
- Proper way to use useSelect
- Access to apache logs from plugin
- Two different wordpress sites – same server and IP address. Gaining Access to database 1 of 2
- Translating plugin settings page – dropdown list
- Hide one specific woocoomerce product
- Remove Meta-boxes (Yoast SEO plugin) [duplicate]
- wp_schedule_single_event is set correctly but sometimes not fired
- Attaching Image-file to userId
- wp.media gallery collection sometimes undefined
- Can’t load a script in my plugin page
- ajax call return 406 not acceptable for non logged users only
- $ is not defined [duplicate]
- replacing jquery google cdn with a new version dynamically
- Dynamically getting tags in post edit screen
- WordPress mails being sent from @locahost and being rejected
- How to implement pagination into a wpdb->result query?
- Slug is not shown for my custom post type
- What method should I use to store my plugin data (multi level menus with options on each item)
- problem with blank page
- Getting error of unexpected output during activation
- Cannot echo a JS variable to a jQuery plugin coming from wp_localize_script
- Select options not reloading after form submit
- Plugin SVN folder structure
- how many rupee or dollar charge to client to make theme [closed]
- Need someone to help you want to manage points for members to code interface functions? thank you
- Run different permission_callback depending on HTTP method of custom REST API endpoint