wp/wp-includes/sitemaps/providers/class-wp-sitemaps-taxonomies.php
changeset 18 be944660c56a
parent 16 a86126ab1dd4
child 19 3d72ae0968f4
equal deleted inserted replaced
17:34716fd837a4 18:be944660c56a
    36 		$taxonomies = get_taxonomies( array( 'public' => true ), 'objects' );
    36 		$taxonomies = get_taxonomies( array( 'public' => true ), 'objects' );
    37 
    37 
    38 		$taxonomies = array_filter( $taxonomies, 'is_taxonomy_viewable' );
    38 		$taxonomies = array_filter( $taxonomies, 'is_taxonomy_viewable' );
    39 
    39 
    40 		/**
    40 		/**
    41 		 * Filter the list of taxonomy object subtypes available within the sitemap.
    41 		 * Filters the list of taxonomy object subtypes available within the sitemap.
    42 		 *
    42 		 *
    43 		 * @since 5.5.0
    43 		 * @since 5.5.0
    44 		 *
    44 		 *
    45 		 * @param WP_Taxonomy[] $taxonomies Array of registered taxonomy objects keyed by their name.
    45 		 * @param WP_Taxonomy[] $taxonomies Array of registered taxonomy objects keyed by their name.
    46 		 */
    46 		 */
    97 
    97 
    98 		$taxonomy_terms = new WP_Term_Query( $args );
    98 		$taxonomy_terms = new WP_Term_Query( $args );
    99 
    99 
   100 		if ( ! empty( $taxonomy_terms->terms ) ) {
   100 		if ( ! empty( $taxonomy_terms->terms ) ) {
   101 			foreach ( $taxonomy_terms->terms as $term ) {
   101 			foreach ( $taxonomy_terms->terms as $term ) {
       
   102 				$term_link = get_term_link( $term, $taxonomy );
       
   103 
       
   104 				if ( is_wp_error( $term_link ) ) {
       
   105 					continue;
       
   106 				}
       
   107 
   102 				$sitemap_entry = array(
   108 				$sitemap_entry = array(
   103 					'loc' => get_term_link( $term ),
   109 					'loc' => $term_link,
   104 				);
   110 				);
   105 
   111 
   106 				/**
   112 				/**
   107 				 * Filters the sitemap entry for an individual term.
   113 				 * Filters the sitemap entry for an individual term.
   108 				 *
   114 				 *
   148 
   154 
   149 		if ( null !== $max_num_pages ) {
   155 		if ( null !== $max_num_pages ) {
   150 			return $max_num_pages;
   156 			return $max_num_pages;
   151 		}
   157 		}
   152 
   158 
   153 		$term_count = wp_count_terms( $taxonomy, $this->get_taxonomies_query_args( $taxonomy ) );
   159 		$term_count = wp_count_terms( $this->get_taxonomies_query_args( $taxonomy ) );
   154 
   160 
   155 		return (int) ceil( $term_count / wp_sitemaps_get_max_urls( $this->object_type ) );
   161 		return (int) ceil( $term_count / wp_sitemaps_get_max_urls( $this->object_type ) );
   156 	}
   162 	}
   157 
   163 
   158 	/**
   164 	/**