WordPress.org

Make WordPress Core

Opened 2 years ago

Last modified 7 months ago

#16096 new defect (bug)

editing permalink structure in edit site causes 404s on site

Reported by: wpmuguru Owned by:
Priority: normal Milestone: Future Release
Component: Network Admin Version: 3.1
Severity: normal Keywords: has-patch
Cc:

Description

If you edit a sites permalink structure in the network admin edit site screen, the site's rewrite rules do not get updated. The permalink_structure option is used to generate the permalinks on the front end of the site. Hence the rewrite rules will not match the permalinks until the permalink settings screen is visited in the site's dashboard.

The two alternatives are remove the permalink setting from the edit site screen or clear the rewrite rules.

I'm attaching a patch to clear the rewrite rules. The patch uses update_option instead of delete_option because update_option leaves the empty option in the object cache. If the option is deleted then WP will query the DB, add rewrite_rules to the notoptions cache, generate the rules, update the DB & remove rewrite_rules from the notoptions cache.

Attachments (2)

16096.diff (457 bytes) - added by wpmuguru 2 years ago.
16096-2.diff (371 bytes) - added by greuben 2 years ago.

Download all attachments as: .zip

Change History (12)

wpmuguru2 years ago

comment:1 westi2 years ago

  • Milestone changed from Awaiting Review to 3.1
  • Version set to 3.1

Is this a regression?

comment:2 follow-up: greuben2 years ago

I don't think its a regression. Instead of update_option, we can use flush_rewrite_rules?

greuben2 years ago

comment:3 ryan2 years ago

Patches seem fine, but we're very close to release and this is not a regression. Suggesting punt to 3.2.

comment:4 wpmuguru2 years ago

In 3.0 it had delete_option & I've explained why I used update_option instead.

https://core.trac.wordpress.org/browser/branches/3.0/wp-admin/ms-edit.php#L252

comment:5 wpmuguru2 years ago

Was added to 3.0 for #12383

comment:6 nacin2 years ago

  • Keywords punt added

Editing the permalink structure here should be a YMMV situation.

comment:7 ryan2 years ago

The same is true of wp-admin/options.php.

comment:8 nacin2 years ago

  • Milestone changed from 3.1 to Future Release

comment:9 in reply to: ↑ 2 wpmuguru2 years ago

Replying to greuben:

I don't think its a regression. Instead of update_option, we can use flush_rewrite_rules?

No, you cannot flush rewrite rules while switched.

comment:10 SergeyBiryukov7 months ago

  • Keywords punt removed
Note: See TracTickets for help on using tickets.