Make WordPress Core


Ignore:
Timestamp:
01/29/2020 12:43:23 AM (4 years ago)
Author:
SergeyBiryukov
Message:

Docs: Improve inline comments per the documentation standards.

Includes minor code layout fixes for better readability.

See #48303.

File:
1 edited

Legend:

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

    r46985 r47122  
    88
    99//
    10 // Taxonomy Registration
     10// Taxonomy registration.
    1111//
    1212
     
    681681
    682682//
    683 // Term API
     683// Term API.
    684684//
    685685
     
    978978    $term = array_shift( $terms );
    979979
    980     // In the case of 'term_taxonomy_id', override the provided `$taxonomy` with whatever we find in the db.
     980    // In the case of 'term_taxonomy_id', override the provided `$taxonomy` with whatever we find in the DB.
    981981    if ( 'term_taxonomy_id' === $field ) {
    982982        $taxonomy = $term->taxonomy;
     
    15961596        $value = apply_filters( "pre_{$taxonomy}_{$field}", $value );
    15971597
    1598         // Back compat filters
     1598        // Back compat filters.
    15991599        if ( 'slug' === $field ) {
    16001600            /**
     
    16931693    $args     = wp_parse_args( $args, $defaults );
    16941694
    1695     // backward compatibility
     1695    // Backward compatibility.
    16961696    if ( isset( $args['ignore_empty'] ) ) {
    16971697        $args['hide_empty'] = $args['ignore_empty'];
     
    17771777        $defaults['default'] = (int) get_option( 'default_category' );
    17781778        if ( $defaults['default'] === $term ) {
    1779             return 0; // Don't delete the default category
     1779            return 0; // Don't delete the default category.
    17801780        }
    17811781    }
     
    18041804    do_action( 'pre_delete_term', $term, $taxonomy );
    18051805
    1806     // Update children to point to new parent
     1806    // Update children to point to new parent.
    18071807    if ( is_taxonomy_hierarchical( $taxonomy ) ) {
    18081808        $term_obj = get_term( $term, $taxonomy );
     
    22702270    $term_id = (int) $wpdb->insert_id;
    22712271
    2272     // Seems unreachable, However, Is used in the case that a term name is provided, which sanitizes to an empty string.
     2272    // Seems unreachable. However, is used in the case that a term name is provided, which sanitizes to an empty string.
    22732273    if ( empty( $slug ) ) {
    22742274        $slug = sanitize_title( $slug, $term_id );
     
    28182818    $term_id = (int) $term_id;
    28192819
    2820     // First, get all of the original args
     2820    // First, get all of the original args.
    28212821    $term = get_term( $term_id, $taxonomy );
    28222822
     
    29122912    $parent = (int) apply_filters( 'wp_update_term_parent', $args['parent'], $term_id, $taxonomy, $parsed_args, $args );
    29132913
    2914     // Check for duplicate slug
     2914    // Check for duplicate slug.
    29152915    $duplicate = get_term_by( 'slug', $slug, $taxonomy );
    29162916    if ( $duplicate && $duplicate->term_id !== $term_id ) {
     
    30693069    if ( is_bool( $defer ) ) {
    30703070        $_defer = $defer;
    3071         // flush any deferred counts
     3071        // Flush any deferred counts.
    30723072        if ( ! $defer ) {
    30733073            wp_update_term_count( null, null, true );
     
    31493149
    31503150        if ( $object_types == array_filter( $object_types, 'post_type_exists' ) ) {
    3151             // Only post types are attached to this taxonomy
     3151            // Only post types are attached to this taxonomy.
    31523152            _update_post_term_count( $terms, $taxonomy );
    31533153        } else {
    3154             // Default count updater
     3154            // Default count updater.
    31553155            _update_generic_term_count( $terms, $taxonomy );
    31563156        }
     
    31633163
    31643164//
    3165 // Cache
     3165// Cache.
    31663166//
    31673167
     
    34533453
    34543454//
    3455 // Private
     3455// Private.
    34563456//
    34573457
     
    36703670
    36713671//
    3672 // Default callbacks
     3672// Default callbacks.
    36733673//
    36743674
     
    42384238        $termlink = home_url( user_trailingslashit( $termlink, 'category' ) );
    42394239    }
    4240     // Back Compat filters.
     4240
     4241    // Back compat filters.
    42414242    if ( 'post_tag' === $taxonomy ) {
    42424243
     
    45704571 */
    45714572function wp_check_term_hierarchy_for_loops( $parent, $term_id, $taxonomy ) {
    4572     // Nothing fancy here - bail
     4573    // Nothing fancy here - bail.
    45734574    if ( ! $parent ) {
    45744575        return 0;
     
    45834584    $loop = wp_find_hierarchy_loop( 'wp_get_term_taxonomy_parent_id', $term_id, $parent, array( $taxonomy ) );
    45844585    if ( ! $loop ) {
    4585         return $parent; // No loop
     4586        return $parent; // No loop.
    45864587    }
    45874588
Note: See TracChangeset for help on using the changeset viewer.