Make WordPress Core


Ignore:
Timestamp:
08/22/2016 06:24:48 PM (10 years ago)
Author:
DrewAPicture
Message:

Hooks: Standardize naming of dynamic hooks to use interpolation vs concatenation.

Benefits gained in discoverability and self-documentation throughout core trump the negligible performance hit in using interpolation in hook names.

Props ramiy.
See #37748.

File:
1 edited

Legend:

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

    r38292 r38307  
    872872         * @param string      $taxonomy The taxonomy slug.
    873873         */
    874         $_term = apply_filters( "get_$taxonomy", $_term, $taxonomy );
     874        $_term = apply_filters( "get_{$taxonomy}", $_term, $taxonomy );
    875875
    876876        // Bail if a filter callback has changed the type of the `$_term` object.
     
    19161916         * @param array   $object_ids   List of term object IDs.
    19171917         */
    1918         do_action( "delete_$taxonomy", $term, $tt_id, $deleted_term, $object_ids );
     1918        do_action( "delete_{$taxonomy}", $term, $tt_id, $deleted_term, $object_ids );
    19191919
    19201920        return true;
     
    24072407         * @param int $tt_id   Term taxonomy ID.
    24082408         */
    2409         do_action( "create_$taxonomy", $term_id, $tt_id );
     2409        do_action( "create_{$taxonomy}", $term_id, $tt_id );
    24102410
    24112411        /**
     
    24432443         * @param int $tt_id   Term taxonomy ID.
    24442444         */
    2445         do_action( "created_$taxonomy", $term_id, $tt_id );
     2445        do_action( "created_{$taxonomy}", $term_id, $tt_id );
    24462446
    24472447        return array('term_id' => $term_id, 'term_taxonomy_id' => $tt_id);
     
    29882988         * @param int $tt_id   Term taxonomy ID.
    29892989         */
    2990         do_action( "edit_$taxonomy", $term_id, $tt_id );
     2990        do_action( "edit_{$taxonomy}", $term_id, $tt_id );
    29912991
    29922992        /** This filter is documented in wp-includes/taxonomy.php */
     
    30173017         * @param int $tt_id   Term taxonomy ID.
    30183018         */
    3019         do_action( "edited_$taxonomy", $term_id, $tt_id );
     3019        do_action( "edited_{$taxonomy}", $term_id, $tt_id );
    30203020
    30213021        return array('term_id' => $term_id, 'term_taxonomy_id' => $tt_id);
Note: See TracChangeset for help on using the changeset viewer.