コンテンツへスキップ サイドバーへスキップ

Open

Topic Tags: Compatibility

Overview of the issue

When using WP Job Manager with WPML, deleting Job posts or Resume posts from the frontend (Job Dashboard) doesn’t automatically delete their translations. Even when the “When deleting a post, delete translations as well” option is activated in “WPML > Settings > Posts and pages synchronization”.

Workaround

Please, make sure of having a full site backup of your site before proceeding.

For Job Posts

  • Open /wp-content/plugins/wp-job-manager/includes/class-job-dashboard-shortcode.php
  • Look for line 466
  • Replace:
    				case 'delete':
    					// Trash it.
    					wp_trash_post( $job_id );
    
  • With:
    				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 );
    					}
    

For Resume Posts

  • Open /wp-content/plugins/wp-job-manager-resumes/includes/class-wp-resume-manager-shortcodes.php
  • Look for line 125
  • Replace:
    				case 'delete':
    					// Trash it.
    					wp_trash_post( $resume_id );
    
  • With:
    				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 );
    					}
    

返信を投稿

他の人に対してトピックに沿った礼儀正しい対応をお願いします。この投稿に関連しない問題についてサポートが必要な場合は、サポートフォーラムを使用してチャットを開始するか、チケットを送信してください。

次のタグが使用できます:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>