after adding a new rule, you have to flush the rewrite-rules in order to use them
that can be done with the “flush_rewrite_rules” function
http://codex.wordpress.org/Function_Reference/flush_rewrite_rules
or it can be done in going in the Administration Screens -> Settings -> Permalink and just saving without changing something on this screen
Related Posts:
- How to Rewrite WordPress URL for a Plugin
- Rewrite url for existing page without flush_rewrite_rules
- How to change the URL pattern for single post view
- Why doesn’t flush_rewrite_rules run on plugin activation?
- How To Consistently Enforce Rewrite Rule in Plugin Development
- Adding rewrite rule dynamically
- rewrite URL based on selected taxonomy for post page
- 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?
- How can I add rewrite rules to a class-based plugin?
- Custom post type change permalink query
- Using meta_key & meta_value in add_rewrite_rule
- Any way to make Apache’s internal redirect work?
- Custom slug in url for CPT and taxonomy
- add_rewrite_rule not working
- How to Rewrite WordPress URL for a Plugin
- Virtual Page with Registration form
- How to Rewrite WordPress URL for a Plugin
- URL rewrite parameter lost (add_rewrite_rule)
- A tool to analyze rewrite rules? [closed]
- Custom pages with plugin
- Making a plugin file accessible via url rewrite?
- Add rewrite rule to permalink structure
- Custom frontend page for plugin without a ‘physical’ page?
- add_rewrite_rule, plugin activation and plugin deactivation
- Custom Rewriting to Plugin with Parameters
- Plugin to Consume a Web Service
- 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
- External Rewrite Rules
- Rewrite Point Doesn’t Work on Custom Taxonomy
- Does flush_rewrite_rules() remove all rules added by other plugins as well as mine?
- Add_rewrite_rule doesn’t add custom url in plugin
- Does WP Have a Function To Generate .htaccess RewriteCond?
- Custom rewrite rule serves content, but returns 404 error code
- flush_rewrite_rules() not working on plugin activation
- URL rewriting must be activated manually for my plugin
- How to restore WP 5.4 behaviour where a numeric string could added to each page URL and parsed as “page” in WP 5.5?
- Redirect traffic to plugin
- Custom url for a plugin page add_rewrite_rule WordPress
- Append country to ‘pretty’ url but serve same page
- How can I rewrite a URL to pass requests to a custom method via AJAX? (I can’t use admin-ajax.php)
- Help With Rewrite_Rules For a Custom Plug-In
- WordPress Custom URL
- Problem with dinamic add_rewrite_rule()
- 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?
- Create page (not the post type) dynamically
- How to grab query string from wp-content/uploads/.*
- Do rewrites added with add_rewrite_rule() persist after plugin deletion?
- Plugin Development – Get Admin Url (Including cases where wp-admin is not used)
- Forward an old url rewrite scheme to a new one?
- Plugin architecture to pull from API & create dynamic content on WP site?
- Rewriting Image URLs from dynamic to original
- How to link to custom “archive like” page with custom permalink rules “dynamically”
- Custom Path for a Plugin
- Access to the template file of a plug-in
- Rewrite not working since upgrade to 5.9
- Add variables from rewrite rules to query var
- Change cannonical URL after changing url with add_rewrite_rule()
- WordPress rewrite rule depend on meta values not ids
- WordPress: I wanted to use Add rewrite rule multiple times for multiple CPT in my plugin
- Disabling Yoast, All-in-One, and Rank Math on Certain Pages within a Plugin
- WordPress Own Rewrite Rules
- WordPress custom url without using any of the custom tags given
- How to force download a plugin generated file?
- How to pass a more variable with page/subpage in Wordprees URL?
- Custom pages with plugin
- Rewriting URLs with a query string
- How can I map a specific URL pattern to a plugin for processing
- How can I send an id over the url?
- Apache rewrite rules and wordpress problem
- Mapping multiple URLs to same page
- Use custom clean URLs for a plug in
- How to use permalink query to go to specific tabs in posts
- redirect word-press page with page values
- Custom rewrite, url path with parameters to a page
- Using OOP plugin’s methods throughout the website
- Managing two editable fields in gutenberg
- add javascript button to order place button
- How to register activation and deactivation hook in plugin using OOP pattern
- PHP 7 – Class Method Compatibility Issue
- Change reset password URL returned by wp_lostpassword_url() via plugin
- dbDelta() Error – Incorrect index name ” for query ALTER TABLE
- Creating a Link Text like Submit Button in Admin Page
- Auto generate rewrite rules for multiple taxonomies
- How to extend WooCommerce API to show bookable product availability rules?
- WordPress allows multiple users to have same email ID; and I’ve a problem with it!
- Requested URL changes when using custom rewrite rule
- Converting data-name editor plugin to Gutenberg plugin
- Including template in shortcodes
- Securing custom rest API endpoints with public access from PWA
- Experts opinions needed: How (in)secure is this approach?
- how can I insert a link on login page
- add_rewrite_rule not working with custom variables
- 2 Domains pointing to SIngle WordPress , issues with links
- How can I space out images when adding to a post without HTML/CSS/JS?