WordPress.org

Make WordPress Core

Changeset 34787


Ignore:
Timestamp:
10/02/2015 11:56:16 PM (5 years ago)
Author:
johnbillion
Message:

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

File:
1 edited

Legend:

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

    r34718 r34787  
    347347        $wp_taxonomies = array();
    348348
     349    $args = wp_parse_args( $args );
     350
     351    /**
     352     * Filter the arguments for registering a taxonomy.
     353     *
     354     * @since 4.4.0
     355     *
     356     * @param array  $args        Array of arguments for registering a taxonomy.
     357     * @param array  $object_type Array of names of object types for the taxonomy.
     358     * @param string $taxonomy    Taxonomy key.
     359     */
     360    $args = apply_filters( 'register_taxonomy_args', $args, $taxonomy, (array) $object_type );
     361
    349362    $defaults = array(
    350363        'labels'                => array(),
     
    365378        '_builtin'              => false,
    366379    );
    367     $args = wp_parse_args( $args, $defaults );
     380    $args = array_merge( $defaults, $args );
    368381
    369382    if ( empty( $taxonomy ) || strlen( $taxonomy ) > 32 ) {
Note: See TracChangeset for help on using the changeset viewer.