This thread is resolved. Here is a description of the problem and solution.
Problem: The client has an issue with a custom post type in WordPress. After renaming the custom post type from
news_release
to
news-release
, the connection between English (EN) and French (FR) posts was lost, and the posts started to appear as duplicates in the database.
Solution: We recommend the following steps to resolve the issue: 1. Create a complete backup of the site and database. 2. Clear the Cache in WPML. 3. Remove ghost entries from the translation tables. 4. Fix
element_type
collation. 5. Fix WPML table collation. 6. Set language information. For more detailed instructions, please refer to our troubleshooting documentation here: WPML Troubleshooting Options.
If this solution does not seem relevant to your issue, please open a new support ticket in our WPML support forum.
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.
I have an issue on my wordpress with a custom post type that was created, it was created incorrectly and posts where being stored with Block Recovery Validation issues. The solve required to rename the custom post type so everything was consistent.
The issue is we I have 300 posts that will all be affected.
I've updated the custom post type from the name of news_release to news-release. Soon as I do that, I lose the connection between my EN and FR posts. They are both still present in the database (actually the entries are in now doubled in the database). The EN and FR posts are essentially now acting like EN posts. I need to make this update and ensure I'm not losing the relationship netween the EN and FR posts for the custom post type.
I made the update with the following logic:
function rename_news_release_post_type() {
$args = array(
'post_type' => 'news_release', // The old post type slug
'posts_per_page' => -1, // Retrieve all posts
'post_status' => 'any', // Include posts of any status
);
$news_release_posts = new WP_Query($args);
if ($news_release_posts->have_posts()) :
while ($news_release_posts->have_posts()) : $news_release_posts->the_post();
$post_id = get_the_ID();
set_post_type($post_id, 'news-release'); // Change to the new post type slug
endwhile;
endif;
wp_reset_postdata();
}
I noticed the posts are doubled after updating the settings to include the custom post type news_release
2) In WPML > Support > Troubeshooting, you'll find a section "cleanup", all the options in that page can be clicked to try to have the database link the content correctly.
at the same time, in that page, you'll find a section with a white box where you can see all the post types and their connection to the slug. can you check if the CPT that is creating issues on your site, is there and appears linked to something or if instead it allows you to do it yourself?
Only try this after a site backup so you have a checkpoint in case something goes wrong (nothing should, though, the steps i gave you are quite harmless).
Let me know what happens there so we can understand how to continue.
Languages: English (English )Spanish (Español )German (Deutsch )
Timezone: Europe/Madrid (GMT+02:00)
Hi,
I attached a screenshot of the section. Please create a complete backup of your site and database and try at least the following options:
- Clear the Cache in WPML
- Remove ghost entries from the translation tables
- Fix element_type collation
- Fix WPML table collation
- Set language information
We use cookies to optimize our website and services. Your consent allows us to process data such as browsing behavior. Not consenting may affect some features.
Functional
Always active
Required for our website to operate and communicate correctly.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
We use these to analyze the statistics of our site. Collected information is completely anonymous.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
These cookies track your browsing to provide ads relevant to you.