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?
- How to Programmatically Replace Characters in WooCommerce Product Slugs?
- Rewriting in wordpress url
- Is this an acceptable practice for WordPress theme development?
- Add loggedout class on body using a function or JS
- Change WooCommerce add_to_cart Button Text?
- Fail to get the total number of posts
- How to use get_posts() function in functions.php
- How to add schema markup to WordPress menu function
- wp_usermeta – Read from database, but save function broken
- remove/hide wp-editor
- Use add_action within template
- How to modify get_the_excerpt() when post-format equals ‘quote’?
- How to use parent theme functions in child theme functions.php file?
- Function not saving unchecked checkbox
- Are innerHTML elements visible to jQuery functions?
- WordPress rewrite rules not working
- Removing parent theme CSS without editing parent theme
- What is the correct way to include my new functions and scripts in WordPress?
- Pagination for custom post types – url rewriting
- two search forms on the same page
- How to override this theme function in child theme
- Getting out side of wp root folder from function.php using absolute path
- configuration of .htaccess for add_rewrite_rule to make sense
- video.js not enqueueing?
- Include Jquery libraries in wordpress theme?
- How to change the displayed URL?
- Showing user profile data on front-end
- Function to replace comment’s accented characters before posting
- wp_nav_menu work in functions.php but not in the theme
- How to register a menu based on a ACF condition
- get_template_directory() – references parent theme directory
- widgets not working
- WooCommerce -> wc_enqueue_js not working [closed]
- Use existing image sizes for WooCommerce
- Do rewrites added with add_rewrite_rule() persist after plugin deletion?
- Only echo Page Content (not page title & page content together)
- Function that prevents users from uploading photos more photos
- How do I display a date correctly that is stored in the database as a backwards 8 digit number from Advanced Custom Fields? [closed]
- How to convert raw url to hyperlink?
- Insert function insde body tag
- Shortcode to get featured image of specific id post
- Split single-review.php to two parts
- Modify shortcode to work with custom post types
- How to hightlight all ancestor menu items of a child page NOT displayed in menu
- Sort and display pages with specific custom field (not tag)
- WP redirect rule doesn’t work
- update_post_meta is Updating with two page id
- Add a mature content warning to first-time visitors
- How do I place a function in a standalone page?
- Problem in using Customizer
- Problem with custom function when I go back with the browser
- Ajax resetting my global variable