WPML
상태
해결됨
보고된 제품
WPML SEO 2.1.0
해결된 버전
2.2.0
관련 플러그인/테마
Rank Math SEO
주제 태그
Compatibility

문제 개요

Rank Math SEO 플러그인에서 제공하는 rank_math_html_sitemap 숏코드가 현재 언어의 콘텐츠만 표시하는 대신 모든 언어의 페이지가 포함된 HTML 사이트맵을 표시합니다.

임시 해결 방법

진행하기 전에 사이트의 전체 백업을 생성했는지 확인하세요.


  • …/wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/html-sitemap/class-posts.php 파일을 여세요.

  • 88번째 줄을 찾으세요.

  • 변경 전:
    		$sql       = "
    			SELECT l.ID, post_title, post_name, post_parent, post_date, post_type, l.post_modified
    			FROM (
    				SELECT DISTINCT p.ID, p.post_modified FROM {$wpdb->posts} as p
    				LEFT JOIN {$wpdb->postmeta} AS pm ON ( p.ID = pm.post_id AND pm.meta_key = 'rank_math_robots' )
    				WHERE (
    					( pm.meta_key = 'rank_math_robots' AND pm.meta_value NOT LIKE '%noindex%' ) OR
    					pm.post_id IS NULL
    				)
    				AND p.post_type IN ( '" . $post_type . "' ) AND p.post_status IN ( '" . join( "', '", esc_sql( $statuses ) ) . "' )
    				ORDER BY p.post_modified DESC
    			)
    			o JOIN {$wpdb->posts} l ON l.ID = o.ID " . $get_child . " ORDER BY " . $sort['field'] . " " . $sort['order']; // phpcs:ignore
    		return $wpdb->get_results( $wpdb->prepare( $sql ) ); // phpcs:ignore

  • 변경 후:
    		$current_language = apply_filters( 'wpml_current_language', NULL );				
    		$sql = "
    		SELECT l.ID, post_title, post_name, post_parent, post_date, post_type, l.post_modified
    		FROM (
    			SELECT DISTINCT p.ID, p.post_modified FROM {$wpdb->posts} as p
    			LEFT JOIN {$wpdb->postmeta} AS pm ON ( p.ID = pm.post_id AND pm.meta_key = 'rank_math_robots' )
    			INNER JOIN {$wpdb->prefix}icl_translations AS icl ON ( p.ID = icl.element_id AND icl.language_code = %s AND icl.element_type LIKE 'post_%' )
    			WHERE (
    				( pm.meta_key = 'rank_math_robots' AND pm.meta_value NOT LIKE '%noindex%' ) OR
    				pm.post_id IS NULL
    			)
    			AND p.post_type IN ( %s ) AND p.post_status IN ( '" . join( "', '", esc_sql( $statuses ) ) . "' )
    			ORDER BY p.post_modified DESC
    		) o
    		JOIN {$wpdb->posts} l ON l.ID = o.ID " . $get_child . " ORDER BY " . $sort['field'] . " " . $sort['order']; // phpcs:ignore
    		$sql = $wpdb->prepare($sql, $current_language, $post_type);
    		return $wpdb->get_results( $sql ); // phpcs:ignore

사이트맵을 초기화해야 할 수도 있습니다. Rank Math SEO > Sitemaps settings로 이동하여 설정을 수정했다가 다시 변경하면 초기화할 수 있습니다.

알려진 모든 문제 →