This is why you need to add rewrite rules on the init
action on every request, as well as on plugin activation.
When your plugin deactivation hook is run, other plugin init
hooks have already run, so their rules exist in the global variable that stores them for the life of each request.
Flushing rewrite rules empties the option that stores the rules long-term, and then repopulates it with whatever is in that global variable.
Related Posts:
- Custom pages with plugin
- Add rewrite rule to permalink structure
- add_rewrite_rule, plugin activation and plugin deactivation
- Add_rewrite_rule doesn’t add custom url in plugin
- flush_rewrite_rules() not working on plugin activation
- Do rewrites added with add_rewrite_rule() persist after plugin deletion?
- WordPress rewrite rule depend on meta values not ids
- Custom pages with plugin
- Apache rewrite rules and wordpress problem
- Add Rewrite Rule for custom page
- What is the best way to output plugin result in certain url
- flush_rewrite_rules not working on plugin deactivation, invalid URLs not showing 404
- Custom rewrite rule is not picked by WordPress
- How can I rewrite a plugin generated URL?
- WordPress custom URL Rewrites redirecting not masking
- Best way to hook a custom url?
- Remove rewrite rules generated by plugin during deactivation
- How does WP handle multiple matching rewrite rules?
- How to Create a Custom Plugin Permalink
- Custom rewrite rules not working with WPML
- How to Create a Custom Slug for Tags and Categories with a prefix or suffix?
- Redirect to another page using contact form 7? [closed]
- Remove .htaccess portion upon plugin deactivation?
- Custom url rewriting
- URL rewrite with external JSON query
- WordPress rewrite rules not working
- How to rewrite URL and get the values?
- How to embed a new string in url?
- i want to rewrite my custom plugin url
- add_rewrite_rule to load different page, without changing URL in browser
- Change custom rewrite rule when permalink is updated/changed
- Change default url to plugin custom post type
- WP Job Manger change jobs url (NOT slug)
- Pass PHP variable to javascript
- Namespaces in WordPress – How do I initiate the main class?
- What areas to Unit test while building a plugin?
- Woocommerce different URL for every table placed in the restaurant
- Pass A Value From Outside To A Plugin Variable
- Custom Post Type Statuses
- How does wordpress distinguish a plugin’s main php file from other php files? [duplicate]
- Deleting images through upload folder, but not deleting from media library
- how to use ajax to display from database and load more in wordpress plugin
- Plugin: How should I handle deleting comments?
- Create or Update thousands of woocommerce products via PHP
- send_headers don’t work on wordpress multisite
- Why was my plugin rejected from the WordPress.org repository?
- Adding content before the loop in category pages
- admin_notices hook show message all admin pages after plugin activate
- Update Option Error: Notice: Undefined index
- Why this global array is returning NULL from a callback function
- How to define WordPress plugin shortcode globally for multisite?
- Why my Plugin keeps deactivating automatically?
- How to get current post user id
- Input with spaces in Shortcode attributes overwritten by defaults
- Unable to override pluggable function wp_mail
- How to find the origin of a file upload from within wp_handle_upload?
- Ajax contact form widget plugin data not insert in database
- Install Plugin via Code
- How to output CMB2 select options from repeated groups select elements?
- register_taxonomy and variable rewrite slug
- WP All Import – Execute Imports
- How to set taxonomy in custom plugin?
- do_action() hook into load-(page)
- How can i create page through plugin
- Check if variable is set in filter
- Custom license for WordPress plugin
- Does using `add_action( ‘init’…` cause performance issues?
- How to write “alt” tag in image for wordpress code?
- How to create plugin/ page that reads from database
- How can I add rewrite rules to a class-based plugin?
- Plugin not properly prepared for localization
- WordPress Active Plugins
- is it possible to hook every page style?
- Redirect logged in user to somepage on every page view?
- How to add filter for wordpress plugin?
- Adding a jQuery modal dialog to the admin area
- How to make a Product page without ordering and database
- How to upload large media file in chunks, without any plugin?
- Change language on website and change currency with url query
- How to store a secret for a plugin inside public_html
- Cannot run script properly with my custom plugin
- Cookie value changes back to previous value after changing
- How to use functions found inside pluggable.php with my plugin files
- Is it okay to make a plugin to the WordPress repo, but limit it’s actions to maximum N events?
- Highlight admin menu items that are parent of existing core items
- Getting all woocommerce products from REST API call in plugin
- AJAX update fails for public/non-admin users
- WordPress Product Detail and catalog
- Create Database Tables on Plugin Activation hook
- How to remove post redirects
- Change page according to fetched GET Parameters
- How to change a specific page to custom page?
- Plugin keeps saying needs to be updated and it’s in a constant loop [closed]
- How use Dynamic hyperlink on each wordpress post?
- _e in wordpress +
- WordPress Code Access to Restricted Content without Registration
- Activate plugin button do nothing [closed]
- WP Elementor Pro causing crtical failure on website
- Function not being called on form submit, only blank admin-post.php page
- How to give specific class name to category in wordpress with code snippets