This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 4 replies, has 2 voices.

Last updated by cooldeep 1 year ago.

Assigned support staff: Bruno.

Author Posts
October 3, 2018 at 7:27 am #2783693

cooldeep

Link to documentation page: https://wpml.org/documentation/translating-your-contents/displaying-untranslated-content-on-pages-in-secondary-languages/deleting-duplicate-content-after-changing-how-content-is-translated/

Hello,

The Query Number 2 'Removing translation settings' isn't executing.

Below's a sample query I am trying to execute taking cues from the example you've posted:

DELETE FROM wp_icl_translations
WHERE element_type = 'post_post' AND element_id IN (
SELECT pm.post_id
FROM wp_postmeta pm
JOIN wp_icl_translations t ON t.element_id = pm.meta_value
WHERE meta_key = '_icl_lang_duplicate_of' AND meta_value > 0 AND t.language_code = 'YYYY'

I am getting the following error:

"#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 6"

October 4, 2018 at 11:36 pm #2788920

Bruno
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hello,

Thank you for contacting us. Please, my sincere apologies for the delay in answering.

Make sure you are copying the complete code. In your code, it looks like it's missing the last line ")". I'll attach an image for you to see.

Also, remember to change the XXXX and YYYY to the language codes you want.

Please, let me know if I can help with any other questions you may have. I'll be happy to help.

Thank you.

October 5, 2018 at 5:49 am #2789575

cooldeep

Hi,

In spite of entering the query correctly, MySQL is still giving issues. Below is the query I am trying to execute:

DELETE FROM wp_icl_translations
WHERE element_type = 'post_post' AND element_id IN (
SELECT pm.post_id
FROM wp_postmeta pm
JOIN wp_icl_translations t ON t.element_id = pm.meta_value
WHERE meta_key = '_icl_lang_duplicate_of' AND meta_value > 0 AND t.language_code = 'en')

The following is the ERROR I am getting:
#1093 - You can't specify target table 'wp_icl_translations' for update in FROM clause

Please view attached screenshot.

The following are the list of all the 'element_type' that currently exists in my DB:

comment
post_attachment
post_bp-email
post_epx_vcsb
post_foogallery-album
post_forum
post_job_listing
post_nav_menu_item
post_page
post_post
post_rtmedia_album
post_topic
post_tribe_events
post_tribe_organizer
post_tribe_venue
post_vc_grid_item
post_wpcf7_contact_form
tax_bp-email-type
tax_category
tax_job_listing_category
tax_job_listing_region
tax_nav_menu
tax_post_format
tax_topic-tag
tax_translation_priority
tax_tribe_events_cat

October 5, 2018 at 7:17 am #2789694

Bruno
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hi,

Please, try this one:

DELETE FROM wp_icl_translations
WHERE element_type = 'post_post' AND element_id IN (
SELECT * FROM ( SELECT pm.post_id
	FROM wp_postmeta pm
	JOIN wp_icl_translations t ON t.element_id = pm.meta_value
	WHERE meta_key = '_icl_lang_duplicate_of' AND meta_value > 0 AND t.language_code = 'en' ) AS A
);

Note that it is recommended to backup your database before executing the queries.

Thank you.

October 5, 2018 at 7:23 pm #2791572

cooldeep

My issue is resolved now. Thank you!