WPML
Status
Aberto
Plugin/tema relacionado
WP Job Manager
Tags de tópico
Compatibility

Visão geral do problema

Ao usar o WP Job Manager com o WPML, excluir posts de Vaga ou posts de Currículo do frontend (Job Dashboard) não exclui automaticamente suas traduções. Mesmo quando a opção “Quando excluir um post, excluir as traduções também” está ativada em “WPML > Configurações > Sincronização de posts e páginas”.

Solução alternativa

Por favor, certifique-se de ter um backup completo do seu site antes de prosseguir.

Para posts de vagas


  • Abra /wp-content/plugins/wp-job-manager/includes/class-job-dashboard-shortcode.php

  • Procure a linha 466

  • Substitua:
    				case 'delete':
    					// Trash it.
    					wp_trash_post( $job_id );

  • Por:
    				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 );
    					}

Para posts de currículos


  • Abra /wp-content/plugins/wp-job-manager-resumes/includes/class-wp-resume-manager-shortcodes.php

  • Procure a linha 125

  • Substitua:
    				case 'delete':
    					// Trash it.
    					wp_trash_post( $resume_id );

  • Por:
    				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 );
    					}

Todos os problemas conhecidos →