WordPress.org

Make WordPress Core

Opened 13 months ago

Last modified 10 months ago

#51805 new defect (bug)

Clarify the prerequisites for updating the .htaccess file in flush_rewrite_rules()

Reported by: SergeyBiryukov Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: Rewrite Rules Keywords:
Focuses: docs Cc:

Description

Background: #51723

In flush_rewrite_rules(), the documentation for the $hard parameter currently says:

Whether to update .htaccess (hard flush) or just update rewrite_rules option (soft flush). Default is true (hard).

However, this does not mention that WP_Rewrite::flush_rules() only calls save_mod_rewrite_rules() if the function exists, which is only loaded in the admin.

Moreover, there is a section in wp-admin/admin.php to flush the rewrite rules when a database version is bumped, but save_mod_rewrite_rules() is not loaded yet at that point, leading to some confusion.

The function should clearly state what exactly is needed for updating the .htaccess file.

Another idea suggested in #51723 is to make sure save_mod_rewrite_rules() is loaded to regenerate the file when flushing the rewrite rules after database version bumps, see comment:5:ticket:51723.

Change History (2)

This ticket was mentioned in Slack in #core by metalandcoffee. View the logs.


10 months ago

#2 @lukecarbis
10 months ago

  • Milestone changed from 5.7 to Future Release
Note: See TracTickets for help on using tickets.