The Taxonomy Management Interface provides administrative UI components for linking taxonomy terms (categories, tags, custom taxonomies) across language blogs in a multisite network. This system allows editors to establish translation relationships between terms, similar to how posts are linked but with taxonomy-specific considerations.
This page documents the term linking interface. For post/page linking, see 4.2. For information about how term relationships are stored, see 5.1.
The taxonomy management system consists of two primary components:
The system operates in two modes: autocomplete mode (MslsPostTag) and classic mode (MslsPostTagClassic), controlled by the activate_autocomplete option.
Sources: includes/MslsPostTag.php1-274 includes/MslsPostTagClassic.php1-153
System Components:
| Component | Purpose | File |
|---|---|---|
MslsPostTag | Autocomplete-based term linking interface | includes/MslsPostTag.php |
MslsPostTagClassic | Dropdown-based term linking interface | includes/MslsPostTagClassic.php |
MslsCustomColumnTaxonomy | Translation status in list tables | includes/MslsCustomColumnTaxonomy.php |
MslsOptionsTax | Term relationship storage | Referenced in taxonomy classes |
MslsAdminIconTaxonomy | Icon generation for terms | Referenced via factory |
Sources: includes/MslsPostTag.php74-87 includes/MslsPostTagClassic.php1-12 includes/MslsCustomColumnTaxonomy.php1-44
The taxonomy management interface initializes by detecting the current taxonomy and selecting the appropriate UI mode:
The factory pattern at includes/MslsPostTag.php74-87 selects between autocomplete and classic modes based on configuration. The taxonomy is detected using msls_content_types()->acl_request(), which returns the current taxonomy slug from the request context.
Sources: includes/MslsPostTag.php74-87 includes/MslsPostTagClassic.php1-12
The following diagram illustrates the complete user workflow for linking taxonomy terms across blogs:
This workflow demonstrates:
Sources: includes/MslsPostTag.php120-146 includes/MslsPostTag.php218-222 includes/MslsMain.php131-179
In autocomplete mode, the add term screen displays text input fields with AJAX-powered suggestions:
The HTML structure generated includes:
msls_id_{blog_id} storing the selected term IDmsls_title_{blog_id} for autocomplete suggestionsSources: includes/MslsPostTag.php94-112 includes/MslsPostTag.php159-211
Classic mode renders dropdown select boxes populated with all available terms:
The print_option() method at includes/MslsPostTagClassic.php116-152 queries all terms in the target blog's taxonomy and generates <option> elements with selected attributes for already-linked terms.
Sources: includes/MslsPostTagClassic.php22-40 includes/MslsPostTagClassic.php84-106 includes/MslsPostTagClassic.php116-152
The edit screen differs from the add screen primarily in HTML structure (table rows vs. form fields) and the availability of existing term data:
Key differences from add screen:
<tr>, <th>, <td>) instead of <div> wrapperSources: includes/MslsPostTag.php120-146 includes/MslsPostTag.php159-211
The classic mode edit screen follows the same pattern but uses <select> elements:
Note the hide_empty: false parameter at includes/MslsPostTagClassic.php131 ensures all terms are available for linking, not just those with posts.
Sources: includes/MslsPostTagClassic.php48-72 includes/MslsPostTagClassic.php116-152
The autocomplete functionality uses AJAX to fetch term suggestions as the user types:
The suggestion endpoint at includes/MslsPostTag.php23-72 performs these operations:
get_terms() with configurable argumentsmsls_post_tag_suggest_args and msls_post_tag_suggest_term filtersSources: includes/MslsPostTag.php23-72
When a term is saved with translation links, the system executes a bidirectional save operation:
The get_input_array() method at includes/MslsMain.php67-90 extracts term IDs from POST data by looking for keys prefixed with msls_input_. The save process ensures relationships are recorded bidirectionally across all linked blogs.
Sources: includes/MslsPostTag.php218-222 includes/MslsMain.php131-179 includes/MslsMain.php67-90
When an administrator clicks a "create" link from a term's list table, the new term form is pre-populated with a link back to the origin term:
This mechanism at includes/MslsPostTag.php231-261 checks for msls_id and msls_lang query parameters, validates the origin term exists, and pre-populates the relationship.
Sources: includes/MslsPostTag.php231-261 includes/MslsMetaBox.php378-407
The MslsCustomColumnTaxonomy class adds translation status indicators to taxonomy list tables:
The icons displayed in the list table column have three states:
| State | Icon | Meaning |
|---|---|---|
| No Translation | Plus icon (dashicons-plus) | No translation exists; click to create |
| Translation Exists | Edit icon (dashicons-edit) | Translation exists; click to edit |
| Flag/Label Mode | Flag or language badge | Visual indicator only (when icon_type is flag or label) |
The icon type is determined by options->get_icon_type() which can be flag, label, or action. When set to action, the icons are interactive and link to either the create or edit screen.
Sources: includes/MslsCustomColumnTaxonomy.php1-44 includes/MslsCustomColumn.php1-110 includes/MslsAdminIcon.php206-220
The taxonomy management interface provides several filter hooks for customization:
| Filter | Purpose | Location | Parameters |
|---|---|---|---|
msls_post_tag_suggest_args | Modify term query arguments for autocomplete | includes/MslsPostTag.php53 | $args (array) |
msls_post_tag_suggest_term | Modify term object before using in suggestions | includes/MslsPostTag.php62 | $term (WP_Term) |
msls_term_select_title | Change the title displayed above term inputs | includes/MslsPostTag.php269-272 | None (returns string) |
msls_main_save | Completely override the save routine | includes/MslsMain.php141 | $object_id, $class_name |
msls_admin_icon_get_edit_new | Customize the create/edit URL | includes/MslsAdminIcon.php283 | $path (string) |
| Action | Purpose | Location | Parameters |
|---|---|---|---|
msls_post_tag_edit_input | After edit form fields rendered | includes/MslsPostTag.php145 | $tag, $taxonomy |
msls_post_tag_add_input | After add form fields rendered | includes/MslsPostTag.php111 | $taxonomy |
msls_post_tag_classic_edit_input | After classic edit form rendered | includes/MslsPostTagClassic.php71 | $tag, $taxonomy |
msls_post_tag_classic_add_input | After classic add form rendered | includes/MslsPostTagClassic.php39 | $taxonomy |
Sources: includes/MslsPostTag.php46-72 includes/MslsPostTag.php111 includes/MslsPostTag.php145
The system uses a specific naming pattern for form fields:
Autocomplete Mode:
msls_id_{blog_id} (e.g., msls_id_2)msls_title_{blog_id} (e.g., msls_title_2)Classic Mode:
msls_input_{language} (e.g., msls_input_de_DE)The get_input_array() method at includes/MslsMain.php67-90 processes these fields by:
INPUT_POST for keys containing Component::INPUT_PREFIX (which equals msls_input_)language => term_idSources: includes/MslsPostTag.php103-105 includes/MslsPostTag.php137-139 includes/MslsPostTagClassic.php29-33
Both MslsPostTag and MslsPostTagClassic use did_action() to prevent duplicate rendering when multiple taxonomies trigger the same hooks:
This check at includes/MslsPostTag.php95 ensures that if multiple taxonomies are registered and the add form is rendered multiple times in a single request, only the first execution proceeds.
Sources: includes/MslsPostTag.php95-97 includes/MslsPostTag.php121-123 includes/MslsPostTagClassic.php23-25
The system extensively uses WordPress's switch_to_blog() and restore_current_blog() functions:
This switching is critical in a multisite environment where each blog has its own set of terms. The pattern is:
Sources: includes/MslsPostTag.php176 includes/MslsPostTag.php204 includes/MslsMain.php164-177
Refresh this wiki