If I had to guess?
The plugin activation hook is firing before the rewrite_rules_array
filter is applied, resulting in the rules being flushed before you make changes to them.
See here for the Codex-recommended implementation, using the wp_loaded
action hook.
Related Posts:
- Is it possible to use multiple post_name, post_title and post_content?
- Rewrite/Change custom taxonomy slug
- add_external_rule – rules deleted when visiting permalinks page
- How to disable wordpress page rewrite rule?
- How to programatically create a simple HTML page using the permalink of a WordPress post?
- Reoccurring 404 Errors on all subpages
- Problem with Author page redirect
- WordPress user account activation
- Permalinks stopped working after migration with WP all-in-one migration plugin
- Multiple instance of data in plugin custom database table on plugin activation
- How to remove custom post type and add category and post name
- Perform internal redirect in WordPress?
- Why this function not working for install database on plugin activation
- Using arbitrary paths in page urls
- “Custom Post Type Permalinks” plugin URL strcuture
- Filtering get_permalink in Jetpack / ShareDaddy
- Custom Permalink Plugin and Current Page/Ancestor in Menus
- How to Create a Custom Slug for Tags and Categories with a prefix or suffix?
- plugin links not working [closed]
- Plugin generated taxonomies’ permalinks with custom placeholders
- register_activation_hook in oop approach
- Redirect to another page using contact form 7? [closed]
- How to create multiple database tables on plugin activation?
- Remove .htaccess portion upon plugin deactivation?
- How to get the permanent link in a plugin?
- Run function on plugin activation before plugin is loaded
- A question about register_activation hook
- Custom url rewriting
- This WordPress plugin isn’t creating links correctly
- register_activation_hook() not working as expected
- flush_rewrite_rules() not working with update_option_{$option}
- Add_rewrite_endpoint doesn’t work with post name permalink structure
- Plugin not working & permalink erorr after upgrade to php 7x on Nginx
- Disable plugin If slug contains specific word
- URL rewrite with external JSON query
- How do I create a custom permalink structure for a page template
- Sub Plugin deactivation when Parent Plugin deactivate
- Advanced WordPress plugin activation detection
- WordPress rewrite rules not working
- I want to filter my products with attributes [closed]
- Do rewrites added with add_rewrite_rule() persist after plugin deletion?
- Apparent errer when installing plugin
- Activate a plugin via a SQL query
- Passing value as hidden parameter to next page
- How to embed a new string in url?
- Make get_permalink() work outside the Loop using filters
- i want to rewrite my custom plugin url
- My plugin does not install correctly if a previous version is still installed
- Plugin for TinyMCE to create reference to other posts
- Is there existing plugins to “Click-to-Launch” embedded Flash / SWF content?
- Permalinks and pagination are not working in WordPress with WP e-Commerce plugin
- help intercepting save_post through plugin
- TranslatePress | secondary language category/sub-category not working correctly “`/%category%/%postname%/“`
- can’t install any wp plugins [duplicate]
- Activation flow of a plugin in a multisite environment
- Why the internal link get converted into a comment?
- Oops! That page can’t be found
- add_rewrite_rule to load different page, without changing URL in browser
- Error in Fetching Custom Post Type parent Category URL (slug)
- Hidden permalink different from displayed permalink
- How to run flush_rewrite_rules on activation after i register my custom post type using WordPress Boilerplate Plugin
- WordPress Frontend Page using Plugin
- Child theme modifications not showing up
- WordPress rewrite rule depend on meta values not ids
- Create new page in wordpress plugin which doesn’t exist
- one url for all pages
- Getting Fatal error: Uncaught Error: Call to undefined function plugin_dir_path() when linking to another file within my wordpress plugin
- How to check for already existing plugin versions on activation? and prevent errors
- Is it possible to have permalinks to sub-domain pages and to root pages within one single WP instance?
- how to enable/activate a plugin per Cpanel
- Add custom WordPress admin page with pretty url via code
- How to update all in-site redirect URLs to destination URLs at once
- My WordPress activation hook isn’t working
- post id or permalink auto-incrementing number and reset everyday
- Change custom rewrite rule when permalink is updated/changed
- plugin: rewrite rules are lost when WP updates
- Changing author slug for a custom role without using plugin
- Category Arabic Slug shows as symbols in plugin lists
- Custom author page for custom role
- Custom role not listed
- Members-only page, but accessible via sharable link
- added code to permalink (URL)
- Cannot modify header information – headers already sent during plugin activation
- How to setup same post slug for different categories?
- How to add add blank non-editable wp page like default blog for use with plugin
- Is it possible to change plugin’s Admin Panel Url?
- get_permalink is causing a whitescreen
- Share on social media created listing after submission
- Rogue splash page keeps popping up
- Coming soon pages with rest of site in maintenance mode
- Custom pages with plugin
- Error Copying Directory On Plugin Activation
- WordPress hook source
- API calls on plugin activation or init?
- Rewrite URL to plugin file
- Apache rewrite rules and wordpress problem
- Different plugins activated online and offline
- How to maintain WordPress permalink structure with custom content with URL parameters?
- Problems with installing and deleting plugins
- How to get the parameters on page and avoid 404?