From a0d0c27eed407fc51ea9e71f8ca40c2b968d803e Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Sun, 31 Jan 2021 23:14:59 +0000 Subject: [PATCH] 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 Built from https://develop.svn.wordpress.org/trunk@50116 git-svn-id: http://core.svn.wordpress.org/trunk@49795 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-taxonomy.php | 20 ++++++++++++++++++++ wp-includes/taxonomy.php | 4 ++++ wp-includes/version.php | 2 +- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/wp-includes/class-wp-taxonomy.php b/wp-includes/class-wp-taxonomy.php index 9c6c1d7caa..3c45eb1e8d 100644 --- a/wp-includes/class-wp-taxonomy.php +++ b/wp-includes/class-wp-taxonomy.php @@ -228,6 +228,24 @@ final class WP_Taxonomy { */ public $rest_controller; + /** + * Whether terms in this taxonomy should be sorted in the order they are provided to `wp_set_object_terms()`. + * + * Use this in combination with `'orderby' => 'term_order'` when fetching terms. + * + * @since 2.5.0 + * @var bool|null + */ + public $sort = null; + + /** + * Array of arguments to automatically use inside `wp_get_object_terms()` for this taxonomy. + * + * @since 2.6.0 + * @var array|null + */ + public $args = null; + /** * Whether it is a built-in taxonomy. * @@ -304,6 +322,8 @@ final class WP_Taxonomy { 'rest_controller_class' => false, 'default_term' => null, '_builtin' => false, + 'sort' => null, + 'args' => null, ); $args = array_merge( $defaults, $args ); diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index 623144e5f0..ab2960fa98 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -414,6 +414,10 @@ function is_taxonomy_hierarchical( $taxonomy ) { * @type string $slug Slug for default term. Default empty. * @type string $description Description for default term. Default empty. * } + * @type bool $sort Whether terms in this taxonomy should be sorted in the order they are + * provided to `wp_set_object_terms()`. Default null which equates to false. + * @type array $args Array of arguments to automatically use inside `wp_get_object_terms()` + * for this taxonomy. * @type bool $_builtin This taxonomy is a "built-in" taxonomy. INTERNAL USE ONLY! * Default false. * } diff --git a/wp-includes/version.php b/wp-includes/version.php index 1466183a6a..88238d6f25 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.7-alpha-50115'; +$wp_version = '5.7-alpha-50116'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.