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?
- What’s the difference between home_url() and site_url()
- WordPress Enqueue for homepage only, functions.php, wp-framework
- Is it possible to remove the main rich Text box editor?
- add_query_vars and add_rewrite_rules
- How to activate “Description” metabox for menu item programmatically?
- Change labels on ‘Nickname’ and ‘Biographical Info’ in user-edit.php
- How to set child post categories to parent post categories when updating parent post?
- WooCommerce add_action hook results in 500 error
- Advice: Template structure – php blocks in sidebar or someting else?
- Help to resolve Syntax error, unexpected ‘endwhile’ (T_ENDWHILE) [closed]
- wp_get_post_terms() returns WP_Error in functions.php but in template it works
- Removing the first image in content
- Make menu structure match page heirarchy on page parent change
- Global functions on WPMU
- Rewrite Rules Are Redirecting and Not Passing VARs
- is_account_page() change to page slug
- Help with WP gallery function, wrap gallery in div
- Can you put a condition on add_image_size() depending on the width of the uploaded image?
- Force to use STRONG users password and implement rule to prevent REUSE [closed]
- Adding an external HTML link to a post thumbnail
- Overwriting the menu break points of twentysixteen in child theme
- Is there a WP function to get taxonomy name from taxonomy_term_id?
- Which functions/classes are available during SHORTINIT?
- Function added using `add_action()` not being called
- How to change this simple code so that it sends the email notification after payment in WooCommerce?
- Allowed memory size of 33554432 bytes exhausted (tried to allocate 9967617 bytes) in …\wp-includes\functions.php
- How to properly set custom logo size?
- Image Crop Not Working
- rewriterule not working
- WordPress can’t get jquery/unslider to work
- how get number of twitter followers in wordpress
- template_redirect action only firing if logged in
- Unable to use get_page_by_title() more than once per page?
- How to Display WooCommerce Product Price in WooCommerce Archive
- Woocommerce Variable Product Dropdown for Custom Shop Template
- Rewrite URL for CPT to domain/post-name/post-id
- Custom permalink structure for custom post types including multiple taxonomy
- large image size of 1440×1440 not pulling 2x of 2880×2880 image
- Its my first time trying to create a website , I got an error Please help
- Help adding custom url, rewrite_rules_array
- restrict uploaded image size and fixed image display size
- Code executes outside of Loop while same code gives ‘Uninitialized string offset’ notice inside a while loop
- Function not receiving string from shortcode
- No Ones Been Able to Override my WordPress Rewrite Rule Issue!
- Restricted images only for logged user. (hidden url)
- Only seems to be displaying one child when there are supposed to be multiple
- WordPress permanently logging users out
- Meta Box value not been pulled in
- Syling Custom Fields echo’s from from functions.php
- Shortcodes not outputting in correct divs
- Help finishing script to export WP user data when form submitted
- WordPress – Notice: Function wp_enqueue_script was called incorrectly