Opened 15 months ago

Last modified 15 months ago

#20171 new defect (bug)

Categories/Tags links are broken in WP 3.3.1, with multisite/subfolder install

Reported by: tszming Owned by:
Priority: normal Milestone: Awaiting Review
Component: Multisite Version: 3.1
Severity: normal Keywords: needs-patch
Cc:

Description

All the default categories/tags links are not working, showing error..

"This is somewhat embarrassing, isn’t it?"

Steps to reproduce:


  1. Install WP 3.3.1 on domain, e.g. http://blog.example.com
  2. Enable multi-site features, using subfolder instead of subdomain
  3. Create a site, e.g. http://blog.example.com/test1
  4. Create a post, e.g. http://blog.example.com/test1/2012/03/04/test1/
  5. Enter the default category link, e.g. http://blog.example.com/test1/category/uncategorized/

Now you will see the message: "This is somewhat embarrassing, isn’t it?"

Fix:


  1. Enter this link: http://blog.example.com/test1/wp-admin/options-permalink.php
  2. Change nothing, press "Save Changes"
  3. Now you can view the link correctly: http://blog.example.com/test1/category/uncategorized/

The above issue also apply to tags

Attachments (1)

rewrite_init.diff (849 bytes) - added by duck_ 15 months ago.

Download all attachments as: .zip

Change History (6)

  • Component changed from Permalinks to Multisite
  • Keywords needs-patch added
  • Severity changed from blocker to normal

Seems like the permalinks are not flushed when creating a site.

  • Version changed from 3.3.1 to 3.1

Rewrite rules are flushed during site creation, see wp_install_defaults().

The problem is that categories, tags and formats have already been registered with the "/blog/" prefix because they were registered during the init of the main site. So, when the rewrite rules are generated they have a different structure to the rest of the rules. I suspect that you encounter the same problem for any custom taxonomies/post types which register with_front as true.

In 3.1 it was only formats that had the problem. with_front => true was introduced for categories and tags in 3.1.1.

duck_15 months ago

I thought of maybe adding a "rewrite_init" action to WP_Rewrite::init() and hooking taxonomy registration onto that. So taxonomies are re-registered whenever the permalink structure is changed.

comment:4 follow-up: ↓ 5   scribu15 months ago

'rewrite_init' seems like a good idea. Any drawbacks to using it for general CPT and taxonomy registration?

comment:5 in reply to: ↑ 4   duck_15 months ago

Replying to scribu:

'rewrite_init' seems like a good idea. Any drawbacks to using it for general CPT and taxonomy registration?

None that I have found so far.

Related #20174.

Note: See TracTickets for help on using tickets.