WordPress.org

Make WordPress Core

Opened 7 years ago

Last modified 8 weeks ago

#20171 reopened defect (bug)

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

Reported by: tszming Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 3.1
Component: Permalinks Keywords: has-patch, bulk-reopened
Focuses: multisite 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 (2)

rewrite_init.diff (849 bytes) - added by duck_ 7 years ago.
20171.diff (1.1 KB) - added by nacin 6 years ago.

Download all attachments as: .zip

Change History (21)

#1 @scribu
7 years ago

  • 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.

#2 @duck_
7 years ago

  • 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_
7 years ago

#3 @duck_
7 years 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.

#4 follow-up: @scribu
7 years ago

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

#5 in reply to: ↑ 4 @duck_
7 years 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.

#6 @duck_
6 years ago

#24585 was marked as a duplicate.

#7 @duck_
6 years ago

  • Milestone changed from Awaiting Review to 3.7

Moving to 3.7 for review per #24585.

#9 @DrewAPicture
6 years ago

  • Keywords has-patch needs-docs added; needs-patch removed

rewrite_init.diff still applies to current trunk. This new action will need docs if we decide to move on it for 3.7.

@nacin
6 years ago

#10 @nacin
6 years ago

  • Keywords commit added; needs-docs removed
  • Milestone changed from 3.7 to 3.8

#11 @jeremyfelt
5 years ago

Tested 20171.diff against current trunk and all works as expected.

#12 @nacin
5 years ago

  • Milestone changed from 3.8 to Future Release

I like this but there are going to be some side effects. For one, WP_Rewrite is init'd well before the init hook, including before the locale is loaded. We could do it on both 'rewrite_init' and 'init', but at that point, we're firing create_initial_taxonomies() *three* times on bootstrap. Maybe we attach it to rewrite_init only after init() runs once.

This needs more testing and careful consideration.

#13 @jeremyfelt
5 years ago

  • Component changed from Multisite to Permalinks
  • Focuses multisite added

#14 @rosyteddy
4 years ago

Its really a long time that this has not been corrected.
New installations can benefit if a small notice is added at the time of Multisite installation:
"If its a subfolder installation "Categories" and "Post Format" links will not work or will be problematic. Do you still want to continue with 'subfolder'?"

Is there any plugin / can any one kindly contribute a plugin for those of us who have already done subfolder installation and later discovered that there site members are unable to use categories out of the box? Thanks.

#15 @boonebgorges
4 years ago

#31567 was marked as a duplicate.

#16 @wonderboymusic
4 years ago

  • Keywords commit removed

#17 @jeremyfelt
3 years ago

#35297 was marked as a duplicate.

#18 @iseulde
4 months ago

  • Milestone Future Release deleted
  • Resolution set to wontfix
  • Status changed from new to closed

This ticket has not seen any activity in over *two* years, so I'm closing it as "wontfix".

The ticket may lack decisiveness, may have become irrelevant, or may not have gathered enough interest.

If you think this ticket does deserve some attention again, feel free to reopen.

For bugs, it would be great if you could provide updated steps to reproduce against the latest version of WordPress (5.0.2 at the time of writing). Remember images or a video can be superior to explain a problem. At the very least, quickly test again to make sure the bug still exists.

If it’s an enhancement or feature, some extra motivation may help.

Thank you for your contributions to WordPress! <3

#19 @JeffPaul
8 weeks ago

  • Keywords bulk-reopened added
  • Milestone set to Awaiting Review
  • Resolution wontfix deleted
  • Status changed from closed to reopened

A decision was made to reopen tickets that were closed in the bulk edit that this ticket was affected by. This ticket is being placed back into the Awaiting Review milestone so it can be individually evaluated and verified to determine if it is still relevant/valid or reproducible.

Note: See TracTickets for help on using tickets.