WPML
상태
해결됨
보고된 제품
WPML Multilingual CMS 3.3.5
해결된 버전
3.4

문제 개요

404 오류:

“Failed to load resource: the server responded with a status of 404 (Not Found)”

admin_url( ‘admin-ajax.php’ )을 호출할 때.

“언어당 개별 도메인” 설정을 사용할 때 문제가 발생합니다.

admin_url( ‘admin-ajax.php’ )을 호출하면 다음과 같이 표시됩니다.

http://secondary-language-domain.com/secondary-lang-code/wp-admin/admin-ajax.php

다음 대신:

http://secondary-language-domain.com/wp-admin/admin-ajax.php.

이로 인해 404 오류가 발생합니다.

“Failed to load resource: the server responded with a status of 404 (Not Found)”.

다음 릴리스에서 수정됩니다.

임시 해결 방법

FTP에 로그인하여 wp-content/plugins/sitepress-multilingual-cms/inc/url-handling/wpml-url-converter.class.php에 있는 wpml-url-converter.class.php 파일을 찾으세요.

admin_url_filter 함수(약 39번째 줄)를 검색하여 다음 코드를:

public function admin_url_filter( $url, $path ) {
    if ( 'admin-ajax.php' === $path ) {
        $url = $this->get_admin_ajax_url( $url );
    }
    return $url;
}

다음과 같이 변경하세요:
public function admin_url_filter( $url, $path ) {
    if ( ( strpos( $url, 'http://' ) === 0 
      || strpos( $url, 'https://' ) === 0 ) 
      && 'admin-ajax.php' === $path 
      && $this->wpml_wp_api->is_front_end() ) {
        global $sitepress;
    
        $url = $this->convert_url( $url,
        $sitepress->get_current_language() );
    }

    return $url;
}

파일을 변경하기 전에 항상 먼저 백업하세요.

알려진 모든 문제 →