- סטטוס
- נפתר
- דווח עבור
- 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 שלך ומצא את הקובץ wpml-url-converter.class.php הממוקם ב־wp-content/plugins/sitepress-multilingual-cms/inc/url-handling/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; }
זכור תמיד לבצע גיבוי תחילה לפני שתשנה משהו בקבצים שלך.