mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
Prevent $taxonony->object_type containing duplicate values. Initial patch props kevinB. Fixes #16951
git-svn-id: http://svn.automattic.com/wordpress/trunk@17688 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
4f9f5f1765
commit
b0fdc73dca
@ -354,7 +354,7 @@ function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
|
||||
unset( $args['capabilities'] );
|
||||
|
||||
$args['name'] = $taxonomy;
|
||||
$args['object_type'] = (array) $object_type;
|
||||
$args['object_type'] = array_unique( (array)$object_type );
|
||||
|
||||
$args['labels'] = get_taxonomy_labels( (object) $args );
|
||||
$args['label'] = $args['labels']->name;
|
||||
@ -437,6 +437,7 @@ function register_taxonomy_for_object_type( $taxonomy, $object_type) {
|
||||
if ( ! get_post_type_object($object_type) )
|
||||
return false;
|
||||
|
||||
if ( ! in_array( $object_type, $wp_taxonomies[$taxonomy]->object_type ) )
|
||||
$wp_taxonomies[$taxonomy]->object_type[] = $object_type;
|
||||
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user