WPML
סטטוס
ממתין למפתח
תוסף/ערכת עיצוב קשורים
Custom Permalinks
תגיות נושא
Compatibility

סקירה כללית של התקלה

בעת שימוש ב־Custom Permalinks עם WPML, קישורים פנימיים לדפים מתורגמים עשויים להפנות לדף בשפה המקורית במקום לדף המתורגם כאשר דף היעד משתמש בקישור קבוע מותאם אישית.

פתרון עוקף

ודא שיש לך גיבוי מלא של האתר לפני שתמשיך.

פתרון עוקף – חלק I


  • פתח את הקובץ …/wp-content/plugins/custom-permalinks/includes/class-custom-permalinks-frontend.php.

  • חפש את שורה 165.

  • החלף את:
    	public function wpml_permalink_filter( $permalink, $language_code ) {
    		$custom_permalink   = $permalink;
    
            


  • בקטע הבא:
    	public function wpml_permalink_filter( $permalink, $language_code ) {
    		$custom_permalink   = $permalink;
    		$language_code = apply_filters( 'wpml_current_language', NULL ); 
            

פתרון עוקף – חלק II


  • באותו קובץ (class-custom-permalinks-frontend.php).

  • חפש את שורה 913.

  • החלף את:
    	public function custom_page_link( $permalink, $page ) {
    		$custom_permalink = get_post_meta( $page, 'custom_permalink', true );
    		if ( $custom_permalink ) {
    			$language_code = apply_filters(
    				'wpml_element_language_code',
    				null,
    				array(
    					'element_id'   => $page,
    					'element_type' => 'page',
    				)
    			);
    
    			$permalink = $this->wpml_permalink_filter(
    				$custom_permalink,
    				$language_code
    			);
    
            


  • בקטע הבא:
    		public function custom_page_link( $permalink, $page ) {
    		$custom_permalink = get_post_meta( $page, 'custom_permalink', true );
    		if ( $custom_permalink ) {
    			$language_code = apply_filters(
    				'wpml_element_language_code',
    				null,
    				array(
    					'element_id'   => $page,
    					'element_type' => 'page',
    				)
    			);
    			$page_translated = apply_filters(
    				'wpml_object_id',
    				$page,
    				'page',
    				$language_code
    			);
    			$custom_translated_permalink = get_post_meta( $page_translated, 'custom_permalink', true );
    			if ( $custom_translated_permalink ) {
    				$custom_permalink = $custom_translated_permalink;
    			}
    			$permalink = $this->wpml_permalink_filter(
    				$custom_permalink,
    				$language_code
    			);
    
            

כל התקלות הידועות →