[wp-trac] [WordPress Trac] #54654: Can flush_rewrite_rules() be called automatically after changing the site URL?

WordPress Trac noreply at wordpress.org
Sat Dec 18 08:52:10 UTC 2021


#54654: Can flush_rewrite_rules() be called automatically after changing the site
URL?
--------------------------+-----------------------------
 Reporter:  pikamander2   |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 A common issue that users run into after changing the WordPress Address
 and/or Site Address (such as when migrating to a new domain) is that some
 of their links stop working correctly after a site change.

 The most common fix/workaround is to go to the wp-admin > Settings >
 Permalinks page and click "Save" once or twice, which usually does the
 trick.

 Examples of this problem and workaround can be found all over Google:

 https://www.google.com/search?q=wordpress+links+not+working+after+migration

 https://wordpress.stackexchange.com/questions/221108/wordpress-links-not-
 working-after-migration

 https://wordpress.stackexchange.com/questions/14685/after-server-
 migration-only-the-homepage-works

 https://wordpress.stackexchange.com/questions/253245/wordpress-migration-
 getting-404-errors-only-home-page-works

 https://stackoverflow.com/questions/42162570/wordpress-issue-after-
 migration-only-homepage-works

 https://stackoverflow.com/questions/39514343/wordpress-migration-broken-
 links

 I'm not sure if there's already a ticket for this anywhere, but surely
 there's some way to do this automatically? The view counters on the
 various Stack Exchange questions suggest that it has affected hundreds of
 thousands or even millions of users, so fixing it would be a fantastic QOL
 improvement, especially for non-technical users and users who don't notice
 the broken links until they start getting complaints.

 Would it be possible to automatically flush_rewrite_rules() in the core
 function that handles the address change? I haven't looked into what
 happens when the permalink settings are resaved, but I would imagine that
 it does something similar there.

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


More information about the wp-trac mailing list