uter::get_base_url( $tax_name . '-sitemap' . $current_page . '.xml' ), 'lastmod' => $date, ]; } } 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 * * @throws OutOfBoundsException When an invalid page is requested. */ public function get_sitemap_links( $type, $max_entries, $current_page ) { global $wpdb; $links = []; if ( ! $this->handles_type( $type ) ) { return $links; } $taxonomy = get_taxonomy( $type ); $steps = $max_entries; $offset = ( $current_page > 1 ) ? ( ( $current_page - 1 ) * $max_entries ) : 0; /** This filter is documented in inc/sitemaps/class-taxonomy-sitemap-provider.php */ $hide_empty = apply_filters( 'wpseo_sitemap_exclude_empty_terms', true, [ $taxonomy->name ] ); /** This filter is documented in inc/sitemaps/class-taxonomy-sitemap-provider.php */ $hide_empty_tax = apply_filters( 'wpseo_sitemap_exclude_empty_terms_taxonomy', $hide_empty, $taxonomy->name ); $terms = get_terms( [ 'taxonomy' => $taxonomy->name, 'hide_empty' => $hide_empty_tax, 'update_term_meta_cache' => false, 'offset' => $offset, 'number' => $steps, ] ); // If there are no terms fetched for this range, we are on an invalid page. if ( empty( $terms ) ) { throw new OutOfBoundsException( 'Invalid sitemap page requested' ); } $post_statuses = array_map( 'esc_sql', WPSEO_Sitemaps::get_post_statuses() ); $replacements = array_merge( [ 'post_modified_gmt', $wpdb->posts, $wpdb->term_relationships, 'object_id', 'ID', $wpdb->term_taxonomy, 'term_taxonomy_id', 'term_taxonomy_id', 'taxonomy', 'term_id', 'post_status', ], $post_statuses, [ 'post_password' ] ); /** * Filter: 'wpseo_exclude_from_sitemap_by_term_ids' - Allow excluding terms by ID. * * @param array $terms_to_exclude The terms to exclude. */ $terms_to_exclude = apply_filters( 'wpseo_exclude_from_sitemap_by_term_ids', [] ); foreach ( $terms as $term ) { if ( in_array( $term->term_id, $terms_to_exclude, true ) ) { continue; } $url = []; $tax_noindex = WPSEO_Taxonomy_Meta::get_term_meta( $term, $term->taxonomy, 'noindex' ); if ( $tax_noindex === 'noindex' ) { continue; } $canonical = WPSEO_Taxonomy_Meta::get_term_meta( $term, $term->taxonomy, 'canonical' ); $url['loc'] = get_term_link( $term, $term->taxonomy ); if ( is_string( $canonical ) && $canonical !== '' && $canonical !== $url['loc'] ) { continue; } $current_replacements = $replacements; array_splice( $current_replacements, 9, 0, $term->taxonomy ); array_splice( $current_replacements, 11, 0, $term->term_id ); //phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- We need to use a direct query here. //phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches. $url['mod'] = $wpdb->get_var( //phpcs:disable WordPress.DB.PreparedSQLPlaceholders -- %i placeholder is still not recognized. $wpdb->prepare( ' SELECT MAX(p.%i) AS lastmod FROM %i AS p INNER JOIN %i AS term_rel ON term_rel.%i = p.%i INNER JOIN %i AS term_tax ON term_tax.%i = term_rel.%i AND term_tax.%i = %s AND term_tax.%i = %d WHERE p.%i IN (' . implode( ', ', array_fill( 0, count( $post_statuses ), '%s' ) ) . ") AND p.%i = '' ", $current_replacements ) ); if ( $this->include_images ) { $url['images'] = $this->get_image_parser()->get_term_images( $term ); } // Deprecated, kept for backwards data compat. R. $url['chf'] = 'daily'; $url['pri'] = 1; /** This filter is documented at inc/sitemaps/class-post-type-sitemap-provider.php */ $url = apply_filters( 'wpseo_sitemap_entry', $url, 'term', $term ); if ( ! empty( $url ) ) { $links[] = $url; } } return $links; } /** * Check if taxonomy by name is valid to appear in sitemaps. * * @param string $taxonomy_name Taxonomy name to check. * * @return bool */ public function is_valid_taxonomy( $taxonomy_name ) { if ( WPSEO_Options::get( "noindex-tax-{$taxonomy_name}" ) === true ) { return false; } if ( in_array( $taxonomy_name, [ 'link_category', 'nav_menu', 'wp_pattern_category' ], true ) ) { return false; } if ( $taxonomy_name === 'post_format' && WPSEO_Options::get( 'disable-post_format', false ) ) { return false; } /** * Filter to exclude the taxonomy from the XML sitemap. * * @param bool $exclude Defaults to false. * @param string $taxonomy_name Name of the taxonomy to exclude.. */ if ( apply_filters( 'wpseo_sitemap_exclude_taxonomy', false, $taxonomy_name ) ) { return false; } return true; } /** * Get the Image Parser. * * @return WPSEO_Sitemap_Image_Parser */ protected function get_image_parser() { if ( ! isset( self::$image_parser ) ) { self::$image_parser = new WPSEO_Sitemap_Image_Parser(); } return self::$image_parser; } } ووردبريس › خطأ

كان هناك خطأ فادح في هذا الموقع.

معرفة المزيد حول استكشاف الأخطاء في ووردبريس.