Make WordPress Core

Changeset 50116


Ignore:
Timestamp:
01/31/2021 11:13:50 PM (6 years ago)
Author:
johnbillion
Message:

Taxonomy: Declare and document the sort and args properties of the WP_Taxonomy class.

These properties have been in use since 2.5 and 2.6 but were never added as actual properties on the class. This fixes that.

Props gunnard, SergeyBiryukov

Fixes #52142

Location:
trunk/src/wp-includes
Files:
2 edited

Legend:

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

    r49790 r50116  
    228228         */
    229229        public $rest_controller;
     230
     231        /**
     232         * Whether terms in this taxonomy should be sorted in the order they are provided to `wp_set_object_terms()`.
     233         *
     234         * Use this in combination with `'orderby' => 'term_order'` when fetching terms.
     235         *
     236         * @since 2.5.0
     237         * @var bool|null
     238         */
     239        public $sort = null;
     240
     241        /**
     242         * Array of arguments to automatically use inside `wp_get_object_terms()` for this taxonomy.
     243         *
     244         * @since 2.6.0
     245         * @var array|null
     246         */
     247        public $args = null;
    230248
    231249        /**
     
    305323                        'default_term'          => null,
    306324                        '_builtin'              => false,
     325                        'sort'                  => null,
     326                        'args'                  => null,
    307327                );
    308328
  • trunk/src/wp-includes/taxonomy.php

    r49963 r50116  
    415415 *         @type string $description  Description for default term. Default empty.
    416416 *     }
     417 *     @type bool          $sort                  Whether terms in this taxonomy should be sorted in the order they are
     418 *                                                provided to `wp_set_object_terms()`. Default null which equates to false.
     419 *     @type array         $args                  Array of arguments to automatically use inside `wp_get_object_terms()`
     420 *                                                for this taxonomy.
    417421 *     @type bool          $_builtin              This taxonomy is a "built-in" taxonomy. INTERNAL USE ONLY!
    418422 *                                                Default false.
Note: See TracChangeset for help on using the changeset viewer.