Ticket #11962 (closed defect (bug): fixed)

Opened 2 years ago

Last modified 2 years ago

The function global_terms() is bugged.

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

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

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

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

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)

  • Cc momo360modena added

comment:5   ryan2 years ago

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

comment:6   ryan2 years ago

Probably in populate_network().

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.

comment:8   ryan2 years ago

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

comment:9   ryan2 years ago

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

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

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