Make WordPress Core


Ignore:
Timestamp:
07/07/2020 12:53:41 AM (5 years ago)
Author:
whyisjake
Message:

Taxonomy: Add support for default terms for custom taxonomies.

The new default_term argument is added to register_taxonomy() allowing a user to define the default term name and optionally slug and description.

Fixes #43517.

Props enrico.sorcinelli, SergeyBiryukov, desrosj, davidbaumwald, whyisjake.

File:
1 edited

Legend:

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

    r48167 r48356  
    540540            }
    541541
    542             if ( 'delete_term' === $cap && ( get_option( 'default_' . $term->taxonomy ) == $term->term_id ) ) {
     542            if ( 'delete_term' === $cap && ( get_option( 'default_' . $term->taxonomy ) == $term->term_id || get_option( 'default_taxonomy_' . $term->taxonomy ) == $term->term_id ) ) {
    543543                $caps[] = 'do_not_allow';
    544544                break;
Note: See TracChangeset for help on using the changeset viewer.