From 27dbbdfba4d881dfd0d8ce6e8a45886f94669717 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Fri, 2 Oct 2015 23:57:25 +0000 Subject: [PATCH] Introduce a `register_taxonomy_args` filter for filtering the arguments passed when calling `register_taxonomy()`. This is the taxonomy equivalent of the newly introduced `register_post_type_args` filter. Fixes #33990 Props tyxla for initial patch Built from https://develop.svn.wordpress.org/trunk@34787 git-svn-id: http://core.svn.wordpress.org/trunk@34752 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/taxonomy-functions.php | 15 ++++++++++++++- wp-includes/version.php | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/wp-includes/taxonomy-functions.php b/wp-includes/taxonomy-functions.php index 51ad965196..8533641a1e 100644 --- a/wp-includes/taxonomy-functions.php +++ b/wp-includes/taxonomy-functions.php @@ -346,6 +346,19 @@ function register_taxonomy( $taxonomy, $object_type, $args = array() ) { if ( ! is_array( $wp_taxonomies ) ) $wp_taxonomies = array(); + $args = wp_parse_args( $args ); + + /** + * Filter the arguments for registering a taxonomy. + * + * @since 4.4.0 + * + * @param array $args Array of arguments for registering a taxonomy. + * @param array $object_type Array of names of object types for the taxonomy. + * @param string $taxonomy Taxonomy key. + */ + $args = apply_filters( 'register_taxonomy_args', $args, $taxonomy, (array) $object_type ); + $defaults = array( 'labels' => array(), 'description' => '', @@ -364,7 +377,7 @@ function register_taxonomy( $taxonomy, $object_type, $args = array() ) { 'update_count_callback' => '', '_builtin' => false, ); - $args = wp_parse_args( $args, $defaults ); + $args = array_merge( $defaults, $args ); if ( empty( $taxonomy ) || strlen( $taxonomy ) > 32 ) { _doing_it_wrong( __FUNCTION__, __( 'Taxonomy names must be between 1 and 32 characters in length.' ), '4.2' ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 9bb0b42bda..779d658e3e 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-alpha-34786'; +$wp_version = '4.4-alpha-34787'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.