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?
- How To Activate Plugins via Code?
- How to check if a theme is active?
- Pluggable function and activation check?
- How Do I add a redirect rule to WordPress?
- Function to activate WordPress theme inside a plugin
- Using rewrite rule to access a view of a plugin from home page
- flush_rewrite_rules not working on plugin deactivation, invalid URLs not showing 404
- Activate Plugin which is in subfolder?
- Change Permalinks Structure to a Sequential Number for Each Post?
- WP get_permalink Return Wrong URL
- Add_rewrite_rule doesn’t add custom url in plugin
- How do I customize my WordPress shortlink structure in link-template.php without a plugin?
- Force plugin to fail activation
- Multisite: Activate plugin for subsites only?
- Correct way to use register_activation_hook
- How can I rewrite a plugin generated URL?
- How to get the permalink of a page when loading my plugin
- WordPress custom URL Rewrites redirecting not masking
- How to add rewrite rules and pagination to retrieve attachments files?
- wordpress in nginx docker container connected to php:8-fpm container and mariadb container isn’t creating any tables on plugin activation
- How to include plugin without activation?
- Rewrite url without flushing the database?
- Default Plugin Settings Not Writing to Database
- Custom page slug without creating a WP page
- Plugin Deactivate Self on Activation Errors
- How to activate plugins for my WordPress sites from a remote server
- How does WP handle multiple matching rewrite rules?
- How do I add a custom sub menu menu under Woo-commerce marketing?
- Load custom PHP on a custom URL via a plugin
- resetting permalinks after changing page names
- Plugin appends ugly URL string to index
- How to make a proper custom post type link
- Pagination Broken on Static Pages but Works on Blog Articles
- How to block plugin activations with no known user or coming from unknown IP address range?
- SEO Friendly URL on dynamic product page produced via shortcode
- Change permalinks of custom post type ‘question’ as post id or any random number once
- Remove /product/ from url. I want only category name then product name
- Redirecting thousands of posts that currently have no category in their permalink when changing permalink structure to include category
- register_taxonomy and variable rewrite slug
- Perform internal redirect in WordPress?
- “Custom Post Type Permalinks” plugin URL strcuture
- Filtering get_permalink in Jetpack / ShareDaddy
- register_activation_hook in oop approach
- How to create multiple database tables on plugin activation?
- Remove .htaccess portion upon plugin deactivation?
- How to get the permanent link in a plugin?
- This WordPress plugin isn’t creating links correctly
- flush_rewrite_rules() not working with update_option_{$option}
- Add_rewrite_endpoint doesn’t work with post name permalink structure
- Disable plugin If slug contains specific word
- Sub Plugin deactivation when Parent Plugin deactivate
- Do rewrites added with add_rewrite_rule() persist after plugin deletion?
- Passing value as hidden parameter to next page
- 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
- Is there existing plugins to “Click-to-Launch” embedded Flash / SWF content?
- can’t install any wp plugins [duplicate]
- add_rewrite_rule to load different page, without changing URL in browser
- How to run flush_rewrite_rules on activation after i register my custom post type using WordPress Boilerplate Plugin
- WordPress Frontend Page using Plugin
- one url for all pages
- 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?
- 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
- Members-only page, but accessible via sharable link
- 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
- Coming soon pages with rest of site in maintenance mode
- Custom pages with plugin
- WordPress hook source
- API calls on plugin activation or init?
- Rewrite URL to plugin file
- Different plugins activated online and offline
- How to create custom content on custom page from plugin?
- Unwanted Links and Spam WordPress Pages and Posts
- homepage olderposts link showing page not found
- Rewrite rule help for gallery plugin
- Custom Table doesn’t create on plugin activation
- Activate plugins by a theme’s functions.php?
- 404 not found problem with URL rewrite custom category
- Is it possible to send user new password after they clicking on forgot password in word press
- Adding Category in URL in some post
- why i cannot see some plugins while they are enabled on network admin page?
- Install theme as part of a plugin
- URL Redirect on GoDaddy platform [closed]
- WordPress Plugin and other pages not opening
- Getting 400 Error in wordpress website
- Changing the “OT Process” Plugin’s Default Slug of /process/