equal
deleted
inserted
replaced
36 * and category labels for hierarchical ones. |
36 * and category labels for hierarchical ones. |
37 * |
37 * |
38 * @see get_taxonomy_labels() |
38 * @see get_taxonomy_labels() |
39 * |
39 * |
40 * @since 4.7.0 |
40 * @since 4.7.0 |
41 * @var object |
41 * @var stdClass |
42 */ |
42 */ |
43 public $labels; |
43 public $labels; |
44 |
44 |
45 /** |
45 /** |
46 * A short descriptive summary of what the taxonomy is for. |
46 * A short descriptive summary of what the taxonomy is for. |
150 |
150 |
151 /** |
151 /** |
152 * Capabilities for this taxonomy. |
152 * Capabilities for this taxonomy. |
153 * |
153 * |
154 * @since 4.7.0 |
154 * @since 4.7.0 |
155 * @var object |
155 * @var stdClass |
156 */ |
156 */ |
157 public $cap; |
157 public $cap; |
158 |
158 |
159 /** |
159 /** |
160 * Rewrites information for this taxonomy. |
160 * Rewrites information for this taxonomy. |
208 * @var string|bool $rest_controller_class |
208 * @var string|bool $rest_controller_class |
209 */ |
209 */ |
210 public $rest_controller_class; |
210 public $rest_controller_class; |
211 |
211 |
212 /** |
212 /** |
|
213 * The controller instance for this taxonomy's REST API endpoints. |
|
214 * |
|
215 * Lazily computed. Should be accessed using {@see WP_Taxonomy::get_rest_controller()}. |
|
216 * |
|
217 * @since 5.5.0 |
|
218 * @var WP_REST_Controller $rest_controller |
|
219 */ |
|
220 public $rest_controller; |
|
221 |
|
222 /** |
213 * The default term name for this taxonomy. If you pass an array you have |
223 * The default term name for this taxonomy. If you pass an array you have |
214 * to set 'name' and optionally 'slug' and 'description'. |
224 * to set 'name' and optionally 'slug' and 'description'. |
215 * |
225 * |
216 * @since 5.5.0 |
226 * @since 5.5.0 |
217 * @var array|string |
227 * @var array|string |
218 */ |
228 */ |
219 public $default_term; |
229 public $default_term; |
220 |
230 |
221 /** |
231 /** |
222 * The controller instance for this taxonomy's REST API endpoints. |
232 * Whether terms in this taxonomy should be sorted in the order they are provided to `wp_set_object_terms()`. |
223 * |
233 * |
224 * Lazily computed. Should be accessed using {@see WP_Taxonomy::get_rest_controller()}. |
234 * Use this in combination with `'orderby' => 'term_order'` when fetching terms. |
225 * |
235 * |
226 * @since 5.5.0 |
236 * @since 2.5.0 |
227 * @var WP_REST_Controller $rest_controller |
237 * @var bool|null |
228 */ |
238 */ |
229 public $rest_controller; |
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; |
230 |
248 |
231 /** |
249 /** |
232 * Whether it is a built-in taxonomy. |
250 * Whether it is a built-in taxonomy. |
233 * |
251 * |
234 * @since 4.7.0 |
252 * @since 4.7.0 |
236 */ |
254 */ |
237 public $_builtin; |
255 public $_builtin; |
238 |
256 |
239 /** |
257 /** |
240 * Constructor. |
258 * Constructor. |
|
259 * |
|
260 * See the register_taxonomy() function for accepted arguments for `$args`. |
241 * |
261 * |
242 * @since 4.7.0 |
262 * @since 4.7.0 |
243 * |
263 * |
244 * @global WP $wp Current WordPress environment instance. |
264 * @global WP $wp Current WordPress environment instance. |
245 * |
265 * |
254 $this->set_props( $object_type, $args ); |
274 $this->set_props( $object_type, $args ); |
255 } |
275 } |
256 |
276 |
257 /** |
277 /** |
258 * Sets taxonomy properties. |
278 * Sets taxonomy properties. |
|
279 * |
|
280 * See the register_taxonomy() function for accepted arguments for `$args`. |
259 * |
281 * |
260 * @since 4.7.0 |
282 * @since 4.7.0 |
261 * |
283 * |
262 * @param array|string $object_type Name of the object type for the taxonomy object. |
284 * @param array|string $object_type Name of the object type for the taxonomy object. |
263 * @param array|string $args Array or query string of arguments for registering a taxonomy. |
285 * @param array|string $args Array or query string of arguments for registering a taxonomy. |
269 * Filters the arguments for registering a taxonomy. |
291 * Filters the arguments for registering a taxonomy. |
270 * |
292 * |
271 * @since 4.4.0 |
293 * @since 4.4.0 |
272 * |
294 * |
273 * @param array $args Array of arguments for registering a taxonomy. |
295 * @param array $args Array of arguments for registering a taxonomy. |
|
296 * See the register_taxonomy() function for accepted arguments. |
274 * @param string $taxonomy Taxonomy key. |
297 * @param string $taxonomy Taxonomy key. |
275 * @param string[] $object_type Array of names of object types for the taxonomy. |
298 * @param string[] $object_type Array of names of object types for the taxonomy. |
276 */ |
299 */ |
277 $args = apply_filters( 'register_taxonomy_args', $args, $this->name, (array) $object_type ); |
300 $args = apply_filters( 'register_taxonomy_args', $args, $this->name, (array) $object_type ); |
278 |
301 |
296 'update_count_callback' => '', |
319 'update_count_callback' => '', |
297 'show_in_rest' => false, |
320 'show_in_rest' => false, |
298 'rest_base' => false, |
321 'rest_base' => false, |
299 'rest_controller_class' => false, |
322 'rest_controller_class' => false, |
300 'default_term' => null, |
323 'default_term' => null, |
|
324 'sort' => null, |
|
325 'args' => null, |
301 '_builtin' => false, |
326 '_builtin' => false, |
302 ); |
327 ); |
303 |
328 |
304 $args = array_merge( $defaults, $args ); |
329 $args = array_merge( $defaults, $args ); |
305 |
330 |