Hi,
I'm hooking into the wp_after_insert_post action to save some post data in a custom database table.
The problem is that when completing the first translation (first translation meaning that you "complete" the translation for the first time) with the Advanced Translation Editor, the custom fields (created with ACF -- setup as "copy") apparently are not yet saved into the postmeta table.
Welcome to WPML support. I'd be happy to help you with this.
Can you provide me with a test staging site where I can check this? To debug this issue further, I would need to check your site settings once, for this I would need temporary access (wp-admin and ftp) to your site.
So could you please provide me with those details, you will find the needed fields for this below the comment area when you log in to leave your next reply. hidden link
Note:
Backup your sites before providing the credentials or if possible provide credentials for the test site
Provide the link where the code is added
Provide me permission to disable/enable everything on the test site.
Hi Shekhar,
the save_post is triggered before the wp_after_insert, so I think that if there are no meta available in insert, they will not be available in save.
What happens to the do_action( 'wpml_sync_all_custom_fields', $id) if I pass the ID of the original post in the main language?
It Synchronizes the values of all custom fields across all translations of a given post. It only does it if the translation option for these custom fields is set to Copy.
I have created a test site here: hidden link can you create a simple example page with demo data and add the function so we can debug this further, No need to add the full code, you can just vardump the results to show the issue.
I've added the code in functions.php:658 of the 2021 theme.
Just create a new post, fill the custom field created with acf (not required though), publish, translate once, you'll see that no meta is printed in the errorlog upon saving the translation the first time.
Just beware that it will save when you publish the post in the original language 🙂
I am discussing this issue with our 2nd tier supporters and will update you further soon.
Thanks
The topic ‘[Closed] Advanced Translation Editor and wp_after_insert_post hook’ is closed to new replies.
Manage Cookie Consent
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.