WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 5 years ago

#5279 closed defect (bug) (worksforme)

cannot use "tag" as permalink base for categories

Reported by: azizpoonawalla Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: General Keywords: tags, categories
Focuses: Cc:

Description

Prior to v2.3.x I had been using the URL base "tags" for my category permalinks, as follows:

<a href="http://www.haibane.info/tags/stranger-than-fiction/">http://www.haibane.info/topic/stranger-than-fiction/</a>

which would return the list of all posts categorized as "stranger than fiction" on my weblog. This is set by the Options:Permalinks menu. The benefit to this was that categories were indexed as tags by Technorati without having to install a full-fledged tag plugin (which was otherwise essentially redundant with existing WP category functionality).

After upgrading to WP 2.3.1 (from v2.2, bypassing v2.3) the link above returns a 404. It seems that the text strings "tag" or "tags" (tag* ?) are reserved only for tags and may not be used for categories. Is this intentional or a bug in how the namespace is designed?

Since you may not have a tag and a category with identical names, there seems no reason for such a limitation to exist. 2.3.x now adds an option to specify the permalink base for cats and for tags separately (sugested as "topics" for the former and "tags" for the latter). If such an option is given to the user, why not permit arbitrary strings; even the perverse case where the permalink base is "categories" for tags and "tags" for categories.

I did attempt to specify the same string for both permalink bases ("tag"). There was no objection from Wordpress, it allowed me to save the setting without error, but the URL above attempting to retrieve all posts from a given category still returned a 404 (and worked fine for a tag example).

My specific feature request for v2.3.2 is that no hidden constraints be placed on what string we choose for permalink bases for either categories or tags. Whether a user chooses all tags, all cats, or some combination of both, or what they desire in their URL permalinks, should be entirely user-determined and no predefined preferences should be hard-coded (by design or accident) into the system.

Change History (6)

comment:1 foolswisdom6 years ago

  • Milestone changed from 2.3.2 to 2.5

comment:2 DD326 years ago

On the Options => Permalinks page, Just set the Category base to 'tags', And set the tag base to something NOT 'tags'

I just tested with /tags for category and /tag for tags, and it works as requested, I also left the tags base empty, and set /tags for category and it works as requested.
The default base for the tags is /tag/, So thats silently taken regardless. Maybe we should add a comment beside them for the defaults?

If WordPress was to mix them both in the same base, it's impossible to tell if the user is requesting the XYZ tag or the XYZ Category, Now, You might not have both, But others will, And you may have it in due time. Why add the extra complexity to it?

comment:3 azizpoonawalla6 years ago

Hmm, you are right, setting category base to "tags" and tag base to "tag" does work. In fact, setting both to "tags" also works, but setting both to "tag" does not work (I get a 404 for the category). There seems to be some innate collision of some kind.

I may be wrong about this but it was my understanding that we could not have a tag and a category with the same name. So I don't see why it should matter that the permalink base is identical.

comment:4 azizpoonawalla6 years ago

I take it back - setting permalink base for both categories and tags to "tags" doesn't work, as all my category links on my sidebar subsequently break (see http://haibane.info). In addition, trying to access a category that is a child of a parent category results is also broken.

comment:5 DD326 years ago

I may be wrong about this but it was my understanding that we could not have a tag and a category with the same name. So I don't see why it should matter that the permalink base is identical.

No such Limitation exists AFAIK.

If you set them both to the same base, then Tags will take priority, and it will cause 404's on the Category link(As no such tag exists as the category link suggests).

In addition, trying to access a category that is a child of a parent category results is also broken.

Must be related to the collisions.

So they cant currently be listed under the same base, If you set the tags base to /tag/ and you set the category base to /tags/ it should work as you want.

comment:6 Denis-de-Bernardy5 years ago

  • Milestone 2.9 deleted
  • Resolution set to worksforme
  • Status changed from new to closed

I'm using /tag and /tags on my own site. One for cats, the other for tags. Works fine.

Note: See TracTickets for help on using tickets.