Skip Navigation

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.

Tagged: 

This topic contains 3 replies, has 3 voices.

Last updated by Marcel 1 year, 6 months ago.

Assisted by: Marcel.

Author Posts
December 9, 2023 at 12:17 am #15028351

darshitS

Hi,

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

How can I possibly solve this issue?

Screenshot 2023-12-08 at 8.58.53 AM.png
December 11, 2023 at 1:18 pm #15037471

Alejandro
WPML Supporter since 02/2018

Languages: English (English ) Spanish (Español ) Italian (Italiano )

Timezone: Europe/Rome (GMT+02:00)

Hello!

I'll try to help you out while a supporter takes your case:

1) WPML needs a minimum of 128MB of memory to work correctly and it seems you are not meeting this requirement.

Kindly add this code into your wp-config.php file, right after the database information:

 

define ('WP_MEMORY_LIMIT', '256M');
define ('WP_MAX_MEMORY_LIMIT', '256M');

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.

December 11, 2023 at 8:27 pm #15040667

darshitS

I could not locate the clean up section, when looking under support > troubleshooting, can you provide a screen grab.

December 12, 2023 at 8:23 am #15042957

Marcel
Supporter

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

More information about the options, you can find here: https://wpml.org/documentation/support/wpml-troubleshooting-options/.

Best Regards
Marcel

cleanup.PNG