WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#9848 closed defect (bug) (worksforme)

Using custom taxonomies breaks permalinks created by the_tags

Reported by: markel Owned by: filosofo
Milestone: Priority: normal
Severity: normal Version: 2.8
Component: Taxonomy Keywords: taxonomy, custom, tags, template, permalinks, the_tags
Focuses: Cc:

Description

Using instructions found here I created a small plugin file to add a custom taxonomy to a 2.8b1 installation. The code was:

add_action( 'init', 'create_my_taxonomies', 1 );

function create_my_taxonomies() {
	register_taxonomy( 'guest', 'post', array( 'hierarchical' => false, 'label' => 'Guests', 'query_var' => true, 'rewrite' => true ) );

After activating this, I created a post with four taxonomy terms under the new guest taxonomy type. I also gave the post a handful of standard post_tag taxonomy terms and one category.

When the post is displayed in the default theme (or any theme, for that matter), the_tags generates the list of post_tag terms, but the permalinks they point to have the new /guest/ taxonomy string rather than the /tag/ string they should have.

e.g. the Post Tag "whatever" is now generating

http://yourblog.com/guest/whatever/

rather than

http://yourblog.com/tag/whatever/

All the post tags added to the post are showing (correctly) in the term_taxonomy database table as post_tag entries and not guest entries.

Deactivating the custom taxonomy plugin does not return the generated links to normal. It is also broken in any new post, even a new post created without any of the custom taxonomy terms.

Change History (2)

comment:1 markel5 years ago

  • Resolution set to worksforme
  • Severity changed from critical to normal
  • Status changed from new to closed

Mystery solved: the "tag base" option in Settings > Permalinks was pointing to "guest" as a string, but I don't remember changing it.

Changing the tag base back to "tag" solved the problem, in any case.

comment:2 Denis-de-Bernardy5 years ago

  • Milestone Unassigned deleted
Note: See TracTickets for help on using tickets.