$item = $this->do_filter( 'sitemap/index/entry', [ 'loc' => Router::get_base_url( $tax_name . '-sitemap' . $current_page . '.xml' ), 'lastmod' => $query->have_posts() ? $query->posts[0]->post_modified_gmt : $last_modified_gmt, ], 'term', $tax_name, ); if ( ! $item ) { continue; } $index[] = $item; } } return $index; } /** * Get set of sitemap link data. * * @param string $type Sitemap type. * @param int $max_entries Entries per sitemap. * @param int $current_page Current page of the sitemap. * @return array */ public function get_sitemap_links( $type, $max_entries, $current_page ) { $links = []; $taxonomy = get_taxonomy( $type ); $terms = $this->get_terms( $taxonomy, $max_entries, $current_page ); Sitemap::maybe_redirect( count( $this->get_terms( $taxonomy, 0, $current_page ) ), $max_entries ); foreach ( $terms as $term ) { $url = []; if ( ! Sitemap::is_object_indexable( $term, 'term' ) ) { continue; } $link = $this->get_term_link( $term ); if ( ! $link ) { continue; } $url['loc'] = $link; $url['mod'] = $this->get_lastmod( $term ); $url['images'] = ! is_null( $this->get_image_parser() ) ? $this->get_image_parser()->get_term_images( $term ) : []; /** This filter is documented at inc/sitemaps/class-post-type-sitemap-provider.php */ $url = $this->do_filter( 'sitemap/entry', $url, 'term', $term ); if ( ! empty( $url ) ) { $links[] = $url; } } return $links; } /** * Get the Image Parser. * * @return Image_Parser */ protected function get_image_parser() { if ( class_exists( 'RankMath\Sitemap\Image_Parser' ) && ! isset( self::$image_parser ) ) { self::$image_parser = new Image_Parser(); } return self::$image_parser; } /** * Get terms for taxonomy. * * @param object $taxonomy Taxonomy name. * @param int $max_entries Entries per sitemap. * @param int $current_page Current page of the sitemap. * @return false|array */ public function get_terms( $taxonomy, $max_entries, $current_page ) { $offset = $current_page > 1 ? ( ( $current_page - 1 ) * $max_entries ) : 0; $hide_empty = ! Helper::get_settings( 'sitemap.tax_' . $taxonomy->name . '_include_empty' ); // Getting terms. $terms = get_terms( [ 'taxonomy' => $taxonomy->name, 'orderby' => 'term_order', 'hide_empty' => $hide_empty, 'offset' => $offset, 'number' => $max_entries, 'exclude' => wp_parse_id_list( Helper::get_settings( 'sitemap.exclude_terms' ) ), /* * Limits aren't included in queries when hierarchical is set to true (by default). * * @link: https://github.com/WordPress/WordPress/blob/5.3/wp-includes/class-wp-term-query.php#L558-L567 */ 'hierarchical' => false, 'update_term_meta_cache' => false, 'meta_query' => [ 'relation' => 'OR', [ 'key' => 'rank_math_robots', 'value' => 'noindex', 'compare' => 'NOT LIKE', ], [ 'key' => 'rank_math_robots', 'compare' => 'NOT EXISTS', ], ], ] ); if ( is_wp_error( $terms ) || empty( $terms ) ) { return []; } return $terms; } /** * Get term link. * * @param WP_Term $term Term object. * @return string */ private function get_term_link( $term ) { $url = get_term_link( $term, $term->taxonomy ); $canonical = Helper::get_term_meta( 'canonical_url', $term, $term->taxonomy ); if ( $canonical && $canonical !== $url ) { /* * Let's assume that if a canonical is set for this term and it's different from * the URL of this term, that page is either already in the XML sitemap OR is on * an external site, either way, we shouldn't include it here. */ return false; } return $url; } /** * Get last modified date of post by term. * * @param WP_Term $term Term object. * @return string */ public function get_lastmod( $term ) { global $wpdb; return DB_Helper::get_var( $wpdb->prepare( " SELECT MAX(p.post_modified_gmt) AS lastmod FROM $wpdb->posts AS p INNER JOIN $wpdb->term_relationships AS term_rel ON term_rel.object_id = p.ID INNER JOIN $wpdb->term_taxonomy AS term_tax ON term_tax.term_taxonomy_id = term_rel.term_taxonomy_id AND term_tax.taxonomy = %s AND term_tax.term_id = %d WHERE p.post_status IN ('publish', 'inherit') AND p.post_password = '' ", $term->taxonomy, $term->term_id ) ); } }
Fatal error: Uncaught Error: Class "RankMath\Sitemap\Providers\Taxonomy" not found in /htdocs/emploitogo.info/wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/html-sitemap/class-sitemap.php:23 Stack trace: #0 /htdocs/emploitogo.info/wp-content/plugins/advanced-custom-fields-pro/vendor/composer/ClassLoader.php(576): include() #1 /htdocs/emploitogo.info/wp-content/plugins/advanced-custom-fields-pro/vendor/composer/ClassLoader.php(427): Composer\Autoload\{closure}('/htdocs/emploit...') #2 /htdocs/emploitogo.info/wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/class-sitemap.php(55): Composer\Autoload\ClassLoader->loadClass('RankMath\\Sitema...') #3 /htdocs/emploitogo.info/wp-content/plugins/seo-by-rank-math/includes/module/class-manager.php(550): RankMath\Sitemap\Sitemap->__construct() #4 /htdocs/emploitogo.info/wp-content/plugins/seo-by-rank-math/includes/module/class-manager.php(530): RankMath\Module\Manager->load_module('sitemap', Object(RankMath\Module\Module)) #5 /htdocs/emploitogo.info/wp-includes/class-wp-hook.php(353): RankMath\Module\Manager->load_modules('') #6 /htdocs/emploitogo.info/wp-includes/class-wp-hook.php(377): WP_Hook->apply_filters(NULL, Array) #7 /htdocs/emploitogo.info/wp-includes/plugin.php(523): WP_Hook->do_action(Array) #8 /htdocs/emploitogo.info/wp-settings.php(757): do_action('after_setup_the...') #9 /htdocs/emploitogo.info/wp-config.php(112): require_once('/htdocs/emploit...') #10 /htdocs/emploitogo.info/wp-load.php(50): require_once('/htdocs/emploit...') #11 /htdocs/emploitogo.info/wp-blog-header.php(13): require_once('/htdocs/emploit...') #12 /htdocs/emploitogo.info/index.php(17): require('/htdocs/emploit...') #13 {main} thrown in /htdocs/emploitogo.info/wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/html-sitemap/class-sitemap.php on line 23