[wp-trac] [WordPress Trac] #54466: Rewrite rules flushed if we save options-permalink even without modification
WordPress Trac
noreply at wordpress.org
Sun Dec 19 10:50:11 UTC 2021
#54466: Rewrite rules flushed if we save options-permalink even without
modification
---------------------------+------------------------------
Reporter: nilav18 | Owner: (none)
Type: defect (bug) | Status: closed
Priority: normal | Milestone: Awaiting Review
Component: Rewrite Rules | Version: 5.8.2
Severity: normal | Resolution: invalid
Keywords: | Focuses: administration
---------------------------+------------------------------
Changes (by bradleyt):
* status: new => closed
* resolution: => invalid
Comment:
Hi Nilav18, Thanks for your ticket.
The rewrite rules are actually flushed every time the `options-
permalink.php` page is visited, even if the options are not saved. This
happens with a call to `flush_rewrite_rules();` at the top of the
`options-permalink.php` file. The permalinks have been flushed in this way
for at least 10 years, and there are many people who now know to expect
and rely on this method for flushing the permalinks.
Usual best practice is to make calls `add_rewrite_rule` on every page load
(i.e. within the `init` action), so that the rules exist whenever
`flush_rewrite_rules` is called. As a plugin or theme author you'd be
expected to rarely call `flush_rewrite_rules()`, maybe only as part of the
initial plugin activation. You may also need to re-run
`flush_rewrite_rules` as part of an upgrade sequence if your rewrite rules
change. You may be able to get extra help with the correct usage of the
WordPress rewrite rules API on the [https://wordpress.org/support/ support
forums].
Whilst I can see how the behaviour can initially be confusing, I don't
there there is an actual bug here and so I am going to close this ticket.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/54466#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list