Skip Navigation

[Résolu] delete all custom post a user created when deleting the user from the users list

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem:
When deleting a user in the backend, how is it possible to make sure that any custom posts they have authored are deleted?

Solution:
WordPress offers you the choice when deleting a user to delete their content or re-assign it.

But it will only consider content as belonging to the user if the custom post type is registered with the 'supports' option set to include author.

When registering a post type with Types at Toolset > Post Types you must specify "author" under the "Sections to display..." section.

This support ticket is created Il y a 6 années et 10 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.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

Ce sujet contient 2 réponses, a 2 voix.

Dernière mise à jour par davidZ-4 Il y a 6 années et 10 mois.

Assisté par: Nigel.

Auteur
Publications
#609156

Tell us what you are trying to do? delete a user from the user list and with it delete all the custom posts the user created.

Is there any documentation that you are following? i couldn't find anything

Is there a similar example that we can see? the default WordPress behavior is to ask what to do with user's posts when the user is deleted. I always selected delete all users posts but still see all the custom posts the user created in the same place...

What is the link to your site? equiblocks.com

#609291

Nigel
Supporter

Les langues: Anglais (English ) Espagnol (Español )

Fuseau horaire: Europe/London (GMT+00:00)

Hi David

I just tested this myself on a local install and when I deleted a user and chose to delete their posts that's exactly what happened, all of their posts, including custom posts created using Types, were deleted.

I don't have any info about your site.

If you are seeing something different, that the posts are not deleted, what happens to them? They are re-assigned to another author?

Can you check if this happens on a minimal install, i.e. with the twentyseventeen theme and with all non-Toolset plugins de-activated.

#609510

Hi Nigel,

i took a deeper look at this and it seems that the posts were assigned to the admin even though i selected to delete content.

to view the author i had to go to the post type and under the "Section to display when editing" check the Author box.
i check posts of user that were deleted and i can see that the Author changed to the admin account.
i then created a custom post type with another user account, then deleted the user and this time the content was deleted. strange!

to confirm this is the behavior i tested even further:
i created two different post types by a user, post type A had the Author box under "Section to display when editing" checked while post type B didn't.
i deleted the user and as expected post type A was deleted but not post type B.

Not sure this is a bug or by design...
at the moment I will use this work around and hope toolset will change/fix this.

Thanks,

David