rebase on oct-10-2023

This commit is contained in:
Rachit Bhargava
2023-10-10 17:23:21 -04:00
parent d37566ffb6
commit d096058d7d
4789 changed files with 254611 additions and 307223 deletions

View File

@@ -457,7 +457,7 @@ class WPSEO_Sitemap_Image_Parser {
);
$gallery_attachments = [];
foreach ( $attachments as $key => $val ) {
foreach ( $attachments as $val ) {
$gallery_attachments[ $val->ID ] = $val;
}

View File

@@ -232,7 +232,7 @@ class WPSEO_Sitemaps_Renderer {
$output .= "\t\t\t<image:loc>" . $this->encode_and_escape( $img['src'] ) . "</image:loc>\n";
$output .= "\t\t</image:image>\n";
}
unset( $img, $title, $alt );
unset( $img );
$output .= "\t</url>\n";

View File

@@ -5,6 +5,8 @@
* @package WPSEO\XML_Sitemaps
*/
use Yoast\WP\SEO\Conditionals\Deactivating_Yoast_Seo_Conditional;
/**
* Rewrite setup and handling for sitemaps functionality.
*/
@@ -14,6 +16,10 @@ class WPSEO_Sitemaps_Router {
* Sets up init logic.
*/
public function __construct() {
// If we add rewrite rules during the plugin's deactivation, the flush_rewrite_rules that we perform afterwards won't properly flush those new rules.
if ( YoastSEO()->classes->get( Deactivating_Yoast_Seo_Conditional::class )->is_met() ) {
return;
}
add_action( 'init', [ $this, 'init' ], 1 );
add_filter( 'redirect_canonical', [ $this, 'redirect_canonical' ] );
@@ -24,7 +30,6 @@ class WPSEO_Sitemaps_Router {
* Sets up rewrite rules.
*/
public function init() {
global $wp;
$wp->add_query_var( 'sitemap' );

View File

@@ -540,26 +540,6 @@ class WPSEO_Sitemaps {
return YoastSEO()->helpers->date->format( self::get_last_modified_gmt( $post_types ) );
}
// phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.Found -- Argument is kept for documentation purposes.
/**
* Notify search engines of the updated sitemap.
*
* @deprecated 19.2
*
* @codeCoverageIgnore
*
* @param string|null $url Optional URL to make the ping for.
*/
public static function ping_search_engines( $url = null ) {
_deprecated_function( __METHOD__, 'Yoast SEO 19.2', 'WPSEO_Sitemaps_Admin::ping_search_engines' );
$admin = new WPSEO_Sitemaps_Admin();
$admin->ping_search_engines();
}
// phpcs:enable
/**
* Get the maximum number of entries per XML sitemap.
*

View File

@@ -246,10 +246,11 @@ class WPSEO_Taxonomy_Sitemap_Provider implements WPSEO_Sitemap_Provider {
continue;
}
$url['loc'] = WPSEO_Taxonomy_Meta::get_term_meta( $term, $term->taxonomy, 'canonical' );
$canonical = WPSEO_Taxonomy_Meta::get_term_meta( $term, $term->taxonomy, 'canonical' );
$url['loc'] = get_term_link( $term, $term->taxonomy );
if ( ! is_string( $url['loc'] ) || $url['loc'] === '' ) {
$url['loc'] = get_term_link( $term, $term->taxonomy );
if ( is_string( $canonical ) && $canonical !== '' && $canonical !== $url['loc'] ) {
continue;
}
$url['mod'] = $wpdb->get_var( $wpdb->prepare( $sql, $term->taxonomy, $term->term_id ) );