Make WordPress Core


Ignore:
Timestamp:
09/20/2022 02:49:25 AM (21 months ago)
Author:
desrosj
Message:

Networks and Sites: Officially remove global terms.

Global terms was a feature from the WordPress MU days where multisite and single site installs used different code bases.

In WordPress 3.0, WordPress MU was merged into one location and the UI [14854] and “on” switch [14880] for global terms were completely removed.

Even before this merge, global terms was bug infested and unreliable. After [14854]/[14880], the feature was no longer maintained and became increasingly broken as taxonomies progressed without it (term splitting and term meta do not work at all). At this point, the feature has not worked in 12+ years and there’s no hope for saving it.

This deprecates the remaining global terms related code and no-ops the functions.

Global terms, you don’t have to go home, but you can’t stay here.

Props scribu, wonderboymusic, SergeyBiryukov, nacin, pento, desrosj, johnjamesjacoby, johnbillion, dd32.
Fixes #21734.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/upgrade.php

    r53897 r54240  
    160160        $cat_slug = sanitize_title( _x( 'Uncategorized', 'Default category slug' ) );
    161161
    162         if ( global_terms_enabled() ) {
    163             $cat_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM {$wpdb->sitecategories} WHERE category_nicename = %s", $cat_slug ) );
    164             if ( null == $cat_id ) {
    165                 $wpdb->insert(
    166                     $wpdb->sitecategories,
    167                     array(
    168                         'cat_ID'            => 0,
    169                         'cat_name'          => $cat_name,
    170                         'category_nicename' => $cat_slug,
    171                         'last_updated'      => current_time( 'mysql', true ),
    172                     )
    173                 );
    174                 $cat_id = $wpdb->insert_id;
    175             }
    176             update_option( 'default_category', $cat_id );
    177         } else {
    178             $cat_id = 1;
    179         }
     162        $cat_id = 1;
    180163
    181164        $wpdb->insert(
     
    35383521}
    35393522
    3540 if ( ! function_exists( 'install_global_terms' ) ) :
    3541     /**
    3542      * Install global terms.
    3543      *
    3544      * @since 3.0.0
    3545      *
    3546      * @global wpdb   $wpdb            WordPress database abstraction object.
    3547      * @global string $charset_collate
    3548      */
    3549     function install_global_terms() {
    3550         global $wpdb, $charset_collate;
    3551         $ms_queries = "
    3552 CREATE TABLE $wpdb->sitecategories (
    3553   cat_ID bigint(20) NOT NULL auto_increment,
    3554   cat_name varchar(55) NOT NULL default '',
    3555   category_nicename varchar(200) NOT NULL default '',
    3556   last_updated timestamp NOT NULL,
    3557   PRIMARY KEY  (cat_ID),
    3558   KEY category_nicename (category_nicename),
    3559   KEY last_updated (last_updated)
    3560 ) $charset_collate;
    3561 ";
    3562         // Now create tables.
    3563         dbDelta( $ms_queries );
    3564     }
    3565 endif;
    3566 
    35673523/**
    35683524 * Determine if global tables should be upgraded.
Note: See TracChangeset for help on using the changeset viewer.