Try using this for the the rewrite:
global $wp_rewrite;
$wp_rewrite->flush_rules( true );
see if that will work.
Related Posts:
- How to add custom rewrite rule to .htaccess?
- SEO Friendly URLs for my plugin categories
- Custom rewrite rules are sending everything to index.php
- WordPress keeps writing rewrite rules to .htaccess
- WordPress Rewrite
- Dynamic URL, not a physical page within the database
- Custom rewrite rule
- Map alt domain to specific section of website w/o MU
- Rewrite rule to load images from production does nothing
- WordPress rewrite rules don’t need ^?
- Url Rewriting a dynamic wordpress page
- My WP_options db rewrite_rules Does Not Work
- Disable Pagination on Pages
- .htaccess rewrite
- Changed pagination URLS to use p= instead of paged=
- Rewriting “pretty” blog category URL with htaccess / add_rewrite_rule() causes 404 page
- WordPress keeps writing rewrite rules to .htaccess
- Customise particular RSS permalink
- RSS feed rewrite matching wrong rule
- Rewrite specific action url
- How do I make WordPress revise an .htaccess file a certain way?
- Rewrite rule that wp-login.php?action=register is left alone
- Pretty URL via Rewrite
- Migration from old CMS to WordPress 301 redirection rules?
- Additional .htaccess rules based on wp page
- What is the proper way to use add_rewrite_rule to remove the (question mark)?
- Can’t get pretty permalinks to work without index.php
- Rewrite Page Parameters
- WP-Include rewrite directory
- How to create custom URL routes?
- Masking wp-content/themes/name/images to just images directory using htaccess
- How do I remove a rewrite rule?
- Use subdomain for certain urls
- add_rewrite_rule: $matches var not replaced by captured value
- Clash of the rewrites
- Disable wordpress pagination URL rewrite for specific page
- How to use Post Custom Metadata in Post Titles and Post Permalinks
- rewrite_rule() not preserving the query string
- WordPress Network on IIS7/SQL Server – Rewrite Issues
- Custom comments
- Add rewrite rule to call front-page.php?
- Having trouble with using add_rewrite_rule and pagination
- Rewriting rules: difference between ‘init’, ‘rewrite_rules_array’, ‘generate_rewrite_rules’?
- Multiple Permalinks for Same Post
- Remove “/page/1” from the URL
- Rewriting URLs in WordPress
- add_rewrite_rule() to route to file other than index.php
- ‘rewrite_rules_array’ or ‘generate_rewrite_rules’ for adding custom rewrite rules?
- remove query arg from url after set query
- NextGEN Gallery Lightbox – Social Share URL Redirect
- Custom rewrite not working
- Rewrite Preview URL to include index.php
- How to add a custom redirect rule for Post as subdomains?
- How to preserve the query string while using add_rewrite_rule and default public query vars
- Rewrite custom post type URL parameters
- “View post” leads to odd URL
- How to use add_rewrite_rule in subdomain
- Rewrite the default post object’s permalink
- Map secondary domain to other’s virtual subfolder
- Enpoint Not Found in Rewrite Tag Permalink
- URL Rewrite and add_query_var not working
- Custom Rewrite Rules
- URL Rewrite with Custom Variables
- htaccess rewrite, adding segment to url
- Rewrite /category/cars into /topics/cars
- show ALL latest posts with archive.php on example.com/latest
- Name page template properly
- force www rewrite if wordpress put in a folder
- One off rewrite for single post-type slug (show normal page with same URL instead)
- How to use wp rewrite to hide form action url?
- WordPress Rewrite rule is not working
- Redirect URL to an existing page with query string or #! added on
- Use URI suffix as parameter and ignore when resolving page
- Why wordpress rewrite my custom URL?
- Rewrite rule regex help required
- Redirect empty search to another page
- Dynamic URL with rewrite rule not working
- Rewrite dynamic URLs as pretty URLs in WordPress functions.php (add_rewrite_rule) – what’s wrong with my code?
- How to get relative page for every post: /post-1/contact. /post-2/contact
- WordPress URL redirect and replace ? question mark
- Rewrite rule not working, suspect redirect string
- Fresh install redirects to www, breaking page loads
- Rewrite Url using .htaccess or hook
- Is it possible to rewrite a page URL from ID to name from an API?
- Rewrite Rule added but showing 404 rather than specified page
- Url wordpress rewrite
- Custom taxonomy Rewrite Rule
- I want to add one extra field to my URLs, I’m using Rewrite functions but it doesn’t work
- .htaccess RewriteRule to include post type and taxonomy
- Font Page overrides rewrites
- rewrite rules social share links
- rewrite rule for home/index page
- Stop wordpress to redirecting home page if no page found
- WordPress Custom Rewrite Rule
- URL Rewriting in WordPress
- Rewrite URL variable to custom path
- Programmatically add a custom url route “/category/index.json” to return a collection of posts in json
- Rewrite URLs in a Custom Post Type with Multiple Taxonomies
- Rewrite rule giving 404 error
- How to combine nearly identical custom rewrite rules for WordPress