[wp-trac] [WordPress Trac] #37561: Inserting rewrite rules using the filter 'option_rewrite_rules' breaks 'WP_Rewrite::flush_rules()', causing 404 errors
WordPress Trac
noreply at wordpress.org
Thu Mar 2 18:04:33 UTC 2023
#37561: Inserting rewrite rules using the filter 'option_rewrite_rules' breaks
'WP_Rewrite::flush_rules()', causing 404 errors
---------------------------+----------------------
Reporter: maratbn | Owner: (none)
Type: defect (bug) | Status: closed
Priority: normal | Milestone:
Component: Rewrite Rules | Version:
Severity: normal | Resolution: invalid
Keywords: close | Focuses:
---------------------------+----------------------
Changes (by hellofromTonya):
* status: new => closed
* resolution: => invalid
Comment:
Hello @maratbn,
Thank you for opening this ticket!
As explained:
>The `option_rewrite_rules` filter really isn't the right place to add
rewrite rules, and IMHO makes this an invalid approach that makes this a
Gravity Forms bug more so than a core issue.
In review of past conversations, it seems the issue is more in how a
plugin or theme is adding or changing rewrite rules, rather than following
the tools available.
>The proper way would be to filter on `rewrite_rules_array` or use
`add_rewrite_rule()` (probably with the 3rd arg set totop).
https://developer.wordpress.org/reference/functions/add_rewrite_rule/
https://developer.wordpress.org/reference/hooks/rewrite_rules_array/
I'm closing this ticket as it does not seem to be a Core issue to resolve.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/37561#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list