Rather than modifying stored rules it would be more reliable to modify rules before they are stored.
flush_rewrite_rules()
callsWP_Rewrite->flush_rules()
WP_Rewrite->wp_rewrite_rules()
WP_Rewrite->rewrite_rules()
Inside last there are fitting hooks to modify rules (after which result they will be saved as usual on each flush):
do_action_ref_array('generate_rewrite_rules', array(&$this));
$this->rules = apply_filters('rewrite_rules_array', $this->rules);
Related Posts:
- Page get parameter doesn’t work with is_single() function
- Custom route and extract data from slashes and parameter
- Add multiple custom fields to the general settings page
- Custom page with variables in url. Nice url with add_rewrite_rule
- Relative URLs and hide /wp-content/themes/
- bloginfo() vs get_option?
- what is the meaning of settings_fields()
- How to add .htaccess code through a function?
- Set default options for inserting media
- Theme options WP Editor
- Pages should have priority when using add_rewrite_rule
- Updating users_can_register option?
- Fatal error when trying to get admin email on contact form
- options.php problem – data not saved
- How can I create a page with a specific URL?
- Hook specific functions if on a specific admin page
- My WP_options db rewrite_rules Does Not Work
- How to rewrite the custom url in wordpress?
- Two Types of settings in WP – The Doubt
- What is the correct way of updating wordpress options
- meta tags doesnt fetch data from permalinks
- How to call particular funcion when the check box is checked in plugin options page
- Move Custom Fields on General Settings Page to New Location
- Redirect to another page using contact form 7? [closed]
- Flush rewrite rules on option update with Settings API
- How to rewrite wordpress search to work on specific category
- How to Add Shortcode to html img code?
- Rewrite permalink for multiple post types (CPT) with taxonomy term
- “options.php” not found
- How do I register a new settings page? [closed]
- Rewrite Question Mark in Post Template with URL Parameter for clean URLs
- Create Custom URL structure for specific Post category using Post ID instead of post name
- add_rewrite_rule to load different page, without changing URL in browser
- reWrite wp-content url to point on my cdn
- How Can I Create a Friendly Slug for a Dynamic Page?
- Add #primary at the end of navlink permalinks on single posts
- Change custom rewrite rule when permalink is updated/changed
- How to change form action of wp-login page with a function
- Route wordpress with template
- Rewrite rules and the permalink
- Edit meta fields from within template
- Problem with add_rewrite_tag
- How to add a meta information to the URL?
- Settings in functions.php used by a plugin
- Random text changing to weird icons in both admin & front end
- Register a widget area when a theme option has been saved?
- How to use WP_rewrite?
- WordPress is adding pagination for all pages not only for blog page, How to remove pagination for all pages except blog/posts page?
- opening links in new tab using – add_filter( ‘the_content’, ‘make_clickable’);
- How to add classes to images based on their categories?
- Wrap gutenberg block ‘div’ in other elements/extra HTML
- Authors details such as social media links, emails etc → Is this Meta or something else?
- Custom rewrite rule is not picked by WordPress
- display public excerpt for private post
- automatically adding submenu items
- Dequeue script in template isn’t working
- How do I call wp_mail from HTML?
- Change permalink for a single post entry
- Adjust which tempalte a page uses with a function?
- WordPress Content Security Policy and Subresource Integrity
- Display trackbacks separately from comments in twentyeleven
- Pass parameters to function through an action
- How to automatically remove links from WordPress Biographical Info?
- Selective Product Category for Carousel
- How to change login labels
- Get the link for RSS item to display in feed
- Commenter should see only his comments in wordpress
- How To Consistently Enforce Rewrite Rule in Plugin Development
- How can i disable auto save & revisions with `function.php` in wordpress?
- Insert image in WordPress with HTML5 tag and caption function
- URL Rewrite with Custom Variables
- error in getting post id
- Rewrite /category/cars into /topics/cars
- (Woocommerce) Order by price when entering specific category
- Exclude category from shortcode
- Get urls of images in a gallery?
- Undefined variable error in new function
- Passing Jquery value to WordPress function
- How to pass variables from one function to another or combine functions
- Unable to add extra elements to the main navi (wp_nav_menu_items)
- Internet Explorer opens links to .msi files as text in a new tab
- call wp_insert_user in custom class doesnt work
- A better way to get stats
- Get URLs for AJAX Filter Checkboxes WordPress
- remove SLASH on single_post but KEEP on categories and parent pages
- Rewrite rule not working, suspect redirect string
- Show number of sold products but be first for less than 2
- Class::$template_dir_path=get_template_directory();
- admin-ajax.php & my wp-admin folder url showing in header
- Is it possible to change parameters of Parent theme function in the Child theme?
- Error function main() is a non-object to construct my Ajax.php
- java script error Uncaught SyntaxError: Unexpected token ILLEGAL
- Gravity Forms After Submission – GFFormsModel::update_lead_field_value?
- Virtual Page with Registration form
- Should I use `get_stylesheet_uri()` or `get_template_directory_uri()` when calling my CSS Stylesheet?
- new to javascript – using in instead of functions.php, not loading correctly
- Remove Disqus JavaScript from homepage
- Missing argument 2
- Setcookie not setting cookies anywhere except admin
- WooCommerce, change “Add to Cart” to “Link to Product”, only for specific categories