WordPress.org

Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#11962 closed defect (bug) (fixed)

The function global_terms() is bugged.

Reported by: momo360modena Owned by: filosofo
Milestone: 3.0 Priority: normal
Severity: normal Version: 2.9.1
Component: Taxonomy Keywords: needs-patch
Focuses: multisite Cc:
PR Number:

Description

The function incriminated :
http://core.trac.wordpress.org/browser/trunk/wp-includes/ms-functions.php#L1790

I have a custom taxonomy (but i think the problem as the same with categories/tags), i edit a term with the ID 199.

The update_term fonction of WordPress work normally, but the mu fonction will return a fake ID in filter.

I edit the term_id 199, the function return 8, and the function update the database with a incorrect ID on the term_taxonomy table.

In fact, this function update the term ID of term_taxonomy table with the ID of the global database... Strange !

I do not propose a patch because I do not know if this table will be preserved in the future.

In the meantime, to correct the problem, it is enough to deactivate the filter with the function remove_filter() in a mu-plugins

Change History (10)

#1 @sirzooro
10 years ago

  • Keywords multisite needs-patch added; wordpressmu global tags removed

#2 @wpmuguru
10 years ago

In MU, term slugs cannot be edited once they are created because the slug is shared across the install.

If you want to change the slug of a term from a plugin, create a new term with the slug you want, add the term to the object(s) & remove the original term from the object(s).

#3 @momo360modena
10 years ago

Just one precision, the bug is caused by a core function of WordPress and it are not related to a custom taxonomy.

In fact, when you import a WordPress blog into WordPress Mu (without the XML import/export, directly by coping tables), you import somes categories and some tags on local blog. But theses local terms aren't added on the global terms...

And when you want edit a term of this freshly imported blog, the edition will corrupted...

I am sure that there is something to improve in this global table... (update schema ? build specific API)

#4 @momo360modena
10 years ago

  • Cc momo360modena added

#5 @ryan
10 years ago

One upgrade to multisite, the sitecategories table needs to be populated from the terms table.

#6 @ryan
10 years ago

Probably in populate_network().

#7 @wpmuguru
10 years ago

If I were "importing" by copying in tables, I would massage the terms tables using the same method I used to import the blog: MySQL.

The issue you are having is that your SQL imported blog has term slug some-thing on term id 123. In the existing MU install the term some-thing already exists as id 456. So, the WordPress function is giving you back the correct id for that term in this MU install.

#8 @ryan
10 years ago

A Tools->Network upgrade from single-blog installs results in term mayhem.

#9 @ryan
10 years ago

[12919] addresses this for Tools->Network upgrades.

#10 @ryan
10 years ago

  • Resolution set to fixed
  • Status changed from new to closed

[12933] further addresses the problem. This is for Tools->Network upgrades only. If you import by hand you also have to setup the sitecategories table by hand. Resolving as fixed.

Note: See TracTickets for help on using tickets.