[wp-trac] [WordPress Trac] #51805: Clarify the prerequisites for updating the .htaccess file in flush_rewrite_rules()

WordPress Trac noreply at wordpress.org
Tue Nov 17 17:08:11 UTC 2020


#51805: Clarify the prerequisites for updating the .htaccess file in
flush_rewrite_rules()
----------------------------+--------------------
 Reporter:  SergeyBiryukov  |      Owner:  (none)
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  5.7
Component:  Rewrite Rules   |    Version:
 Severity:  normal          |   Keywords:
  Focuses:  docs            |
----------------------------+--------------------
 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 [source:tags/5.5.3/src/wp-
 admin/admin.php?marks=40#L38 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 [comment:3:ticket:51723 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.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/51805>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list