[Resolved] Post deletion documentation, when what?
This thread is resolved. Here is a description of the problem and solution.
Problem:
The client was experiencing issues with the WPML setting 'When deleting a post, delete translations as well' not functioning correctly for duplicated posts when deleted from the frontend. The main post would be deleted, but its duplicates would remain.
Solution:
We recommended the following steps after ensuring a full site backup:
1) Navigate to the
/wp-content/plugins/wp-job-manager/includes/
folder. 2) Open the
class-job-dashboard-shortcode.php
file for editing. 3) Locate line number 466 and replace the existing code with:
From
case 'delete':
// Trash it.
wp_trash_post( $job_id );
This code ensures that when a job post is deleted from the frontend, all its translations are also trashed, regardless of the WPML setting.
If this solution does not resolve your issue or seems irrelevant due to updates or differences in your case, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If issues persist, please open a new support ticket at 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.
Background of the issue:
I am working on a site under development and have activated the setting in WPML to delete translations when a post is deleted. I want to understand how this setting works, especially in relation to synced duplicates of posts.
Symptoms:
I am unsure if the deletion setting works for copies and what happens when original or synced copies are deleted.
Questions:
Does the setting to delete translations when a post is deleted also apply to duplicates?
What should happen if the original post is deleted?
What should happen if a synced duplicate is deleted?
Must the deleted post be removed from the trash for the duplicates to be deleted as well?
If we choose the *When deleting a post, delete translations as well* option in WPML>>Settings>>Posts and pages synchronization it will work like the following. Please try it after a full site backup and let us know your feedback.
1) When we Trash an original/default language post its translations will be also trashed
2) When we Trash an original/default language post its duplicates (in the secondary languages) will be also trashed
3) If we permanently delete a post from Trash, its translations/duplicates will be deleted permanently
4) When we Trash/Delete permanently a translated post its original/default language post will not be trashed/deleted
Managing of the jobs is only allowed in the language in which the job is created, because changes are synced then to the copies.
So also deletion is also only allowed in the language, in which the job was created. But the deletion by the user only delets the original job post, the copies are not deleted.
Only if the admin go to the job listing trash and delete this job permanet, all the copies are gone.
Is it possible to get all the copies deleted into the trash with deleting the original post?
Thank you for the details. Yes, if we activate the *When deleting a post, delete translations as well* option, deleting an original language post will also move its translations to the trash.
However, please note that if a post is created in a secondary language and then translated into the site's default (original) language, the post in the secondary language must be deleted first.
You can also select the *When deleting a taxonomy (category, tag or custom), delete translations as well* option of WPML>>Settings>>Posts and pages synchronization.
Hi,
Thanks, I had set also *When deleting a taxonomy (category, tag or custom), delete translations as well* already.
In my system it is set this way:
User adds a job in a second language, this job is duplicated (no translation) and by this there a copies of the by the user created job. The user is only allowed to delete the one he created, and if he do so, the copied jobs are not set to trash and are still in the system published.
So my question: is this a standard function? Then we should check this here. If not I have to go forward with a custom code here.
Thank you for the updates. I have tested a similar case in a sandbox site (fresh installation). It works as expected. I created a couple of custom posts (Books) in the secondary language and duplicated them in the default language. The default language posts moved to Trash when I Trash the post was created in the secondary language.
Please click the following links for more details.
Hi,
Thanks, good idea, yes, I installed here the Jobmanager and made the same test. Yes, all duplicates are in the trash. And I added field manager and acf taxnomies and added a tax field, and it is deleted into the trash. OK.
So remains the question, why is not this way in my site?
Thank you for the updates. Normally it will not happen because of the Post duplication via code. So to make sure, please create a Job post in your live site in a secondary language and duplicate it to the default language (via WPML features). Then delete the secondary language post and make sure the bug exists or not.
Please share a couple of screenshots or a screencast for a better understanding following one.
Have some taxonomies false settings in WPML?
Shall I make troubleshoot with WPML?
1) created a new job in EN in the backend
2) duplicate it into the other languages in the backend
3) in the frontend the job is shown in the job dashboard
4) the user can now delete the job in EN in the frontend
Thank you for the updates. We are getting the expected results in our local copy and the sandbox site after the following steps. Please try it after a full site backup {mandatory} and let us know your feedback.
1) Visit */wp-content/plugins/wp-job-manager/includes/* folder
2) Open the *class-job-dashboard-shortcode.php* file for edit
3) Scroll down to line number 466
4) Make the following changes and save the file
From
case 'delete':
// Trash it.
wp_trash_post( $job_id );
Hi,
Thanks! Great, this is working.
Question:
1) is it possible to add a code in the functions.php?
2) did you contacted WP Jobmanager to add this in their code?
This is not update save and here I am asking for an update save way.
Thanks, kind regards
Eric
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.