WPML

סקירת התקלה

כאשר משתמשים ב־WP Job Manager עם WPML, מחיקת פוסטים מסוג Job או Resume מחזית האתר (Job Dashboard) אינה מוחקת אוטומטית את התרגומים שלהם. אפילו כאשר האפשרות “When deleting a post, delete translations as well” מופעלת ב־”WPML > הגדרות > Posts and pages synchronization”.

פתרון עוקף

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

עבור פוסטים של משרות

  • פתח את /wp-content/plugins/wp-job-manager/includes/class-job-dashboard-shortcode.php
  • חפש את שורה 466
  • החלף את:
    case 'delete':
    	// Trash it.
    	wp_trash_post( $job_id );
  • בקטע הבא:
    case 'delete':
    	// Trash it.
    	// WPML workaround for compsupp-7729
    	if ( class_exists('Sitepress') ) {
    		$trid = apply_filters( 'wpml_element_trid', NULL, $job_id , 'post_job_listing' );
    		$translations = apply_filters( 'wpml_get_element_translations', NULL, $trid, 'job_listing' );
    		if ( !empty( $translations ) ) {
    			foreach ( $translations as $lang => $translation ) {
    				$translation_id = absint( $translation->element_id );
    				wp_trash_post( $translation_id );
    			}
    		}
    	} else {
    		wp_trash_post( $job_id );
    	}

עבור פוסטים של קורות חיים

  • פתח את /wp-content/plugins/wp-job-manager-resumes/includes/class-wp-resume-manager-shortcodes.php
  • חפש את שורה 125
  • החלף את:
    case 'delete':
    	// Trash it.
    	wp_trash_post( $resume_id );
  • בקטע הבא:
    case 'delete':
    	// Trash it.
    	// WPML workaround for compsupp-7757
    	if ( class_exists('Sitepress') ) {
    		$trid = apply_filters( 'wpml_element_trid', NULL, $resume_id , 'post_resume' );
    		$translations = apply_filters( 'wpml_get_element_translations', NULL, $trid, 'resume' );
    		if ( !empty( $translations ) ) {
    			foreach ( $translations as $lang => $translation ) {
    				$translation_id = absint( $translation->element_id );
    				wp_trash_post( $translation_id );
    			}
    		}
    	} else {
    		wp_trash_post( $resume_id );
    	}

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