WPML

Übersicht über das Problem

Wenn Sie WP Job Manager mit WPML verwenden, werden beim Löschen von Job-Beiträgen oder Lebenslauf-Beiträgen aus dem Frontend (Job-Dashboard) deren Übersetzungen nicht automatisch gelöscht. Selbst wenn die Option „Beim Löschen eines Beitrags auch Übersetzungen löschen“ unter „WPML > Einstellungen > Synchronisation von Beiträgen und Seiten“ aktiviert ist.

Problemumgehung

Bitte stellen Sie sicher, dass Sie ein vollständiges Website-Backup Ihrer Website haben, bevor Sie fortfahren.

Für Job-Beiträge

  • Öffnen Sie /wp-content/plugins/wp-job-manager/includes/class-job-dashboard-shortcode.php
  • Suchen Sie nach Zeile 466
  • Ersetzen Sie:
    case 'delete':
    	// Trash it.
    	wp_trash_post( $job_id );
  • Durch:
    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 );
    	}

Für Lebenslauf-Beiträge

  • Öffnen Sie /wp-content/plugins/wp-job-manager-resumes/includes/class-wp-resume-manager-shortcodes.php
  • Suchen Sie nach Zeile 125
  • Ersetzen Sie:
    case 'delete':
    	// Trash it.
    	wp_trash_post( $resume_id );
  • Durch:
    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 );
    	}

Alle bekannten Probleme