[Résolu] post relationship display trash posts in backend
This support ticket is created Il y a 5 années et 9 mois. There's a good chance that you are reading advice that it now obsolete.
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.
I trashed post with types relationsheep (one-to-many). This post is still displayed in the relationship area in the backend, when editing. Is this normal behavior? Tested on lien caché too.
Les langues: Anglais (English )Espagnol (Español )Français (Français )
Fuseau horaire: Pacific/Niue (GMT-11:00)
Hello.
Yes. This is expected behaviour.
"Trash"ing a post is not the same as deleting it from the system. The relationship will/should be cleared of this post.id when the post is "permenantly deleted" from the system.
Hello.
Sorry, but I disagree. I understand that deleting a post is not emptying the trash. But when I delete a post, I guess that it gets into the trash, and the link with the related post is disconnected. If I want to untrash the post - the connection should be restored as well.
Now it does not make sense.
1. I send the related post to the trash.
2. I still see the deleted post in the relationship field in backend.
3. I click "edit". WordPress says - you can not edit the post, because it is in the trash".
This introduces a misunderstanding for the site administrator.
This is unexpected behaviour.
Les langues: Anglais (English )Espagnol (Español )
Fuseau horaire: Europe/London (GMT+00:00)
Hi Max
I found different behaviour depending on from where I sent the related post to the trash.
When editing a parent post where I can see the connected child posts, I can trash the child directly from there, and I would say in that case that the behaviour is entirely as intended and expected.
I get a warning that the operation cannot be undone, and a message to confirm both that the post has been trashed and that the association has been deleted.
The problem is when you trash the post independently of the parent post.
If I go to the admin page to list the child posts and trash the post directly from there then I see what you describe.
I can go back to edit the parent post and the child post still looks connected, but I cannot follow the edit link (to either delete it permanently or restore it) because it is already in the trash.
I'll report this to the developers. It seems like we should use the wp_trash_post hook to enforce the same behaviour, or—at least—not show trashed posts in the list of related posts.