Make WordPress Core

Changeset 52834


Ignore:
Timestamp:
03/10/2022 03:59:35 AM (3 years ago)
Author:
peterwilsoncc
Message:

Sitemaps: Pass term object to wp_sitemaps_taxonomies_entry filter.

Add a forth parameter to the wp_sitemaps_taxonomies_entry filter to pass the entire WP_Term object.

Correct the documentation for the second parameter of the wp_sitemaps_taxonomies_entry filter to indicate it is a term ID rather than term object.

Props RavanH, swissspidy, audrasjb.
Fixes #55239.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/sitemaps/providers/class-wp-sitemaps-taxonomies.php

    r52422 r52834  
    9898
    9999        $args           = $this->get_taxonomies_query_args( $taxonomy );
     100        $args['fields'] = 'all';
    100101        $args['offset'] = $offset;
    101102
     
    118119                 *
    119120                 * @since 5.5.0
     121                 * @since 6.0.0 Added fourth argument for the term object.
    120122                 *
    121123                 * @param array   $sitemap_entry Sitemap entry for the term.
     124                 * @param int     $term_id       Term ID.
     125                 * @param string  $taxonomy      Taxonomy name.
    122126                 * @param WP_Term $term          Term object.
    123                  * @param string  $taxonomy      Taxonomy name.
    124127                 */
    125                 $sitemap_entry = apply_filters( 'wp_sitemaps_taxonomies_entry', $sitemap_entry, $term, $taxonomy );
     128                $sitemap_entry = apply_filters( 'wp_sitemaps_taxonomies_entry', $sitemap_entry, $term->term_id, $taxonomy, $term );
    126129                $url_list[]    = $sitemap_entry;
    127130            }
     
    195198            'wp_sitemaps_taxonomies_query_args',
    196199            array(
    197                 'fields'                 => 'ids',
    198200                'taxonomy'               => $taxonomy,
    199201                'orderby'                => 'term_order',
Note: See TracChangeset for help on using the changeset viewer.