I have a couple of questions regarding wp_delete_post based on some behavior I’m seeing in developing a plugin.
After validating that I have a valid document of type ‘event’ (custom post type) I call the following:
wp_delete_post( $row->event_id , false ) ;
My assumption is that this should either mark the item as ‘trash’ or delete it if it is already marked trash, firing all actions along the way.
This doesn’t seem to be happening. When I call this for a custom post type, the ‘event’ is deleted. Checking the code for wp_delete_post, shows that it will only trash
( $post->post_type == 'post' || $post->post_type == 'page')— everything else is deleted.
This is obviously not the behavior when you click ‘move to trash’ using the WP Admin UI.
So first question is: Is this a bug in wp_delete_post and should I report it (and where…)?
Next, looking in wp_delete_post shows me a function wp_trash_post. Looks like just the ticket for what I want, however it is not listed in the codex, and Googling turns up almost no documentation. While it is prefixed with a “wp_” leads me to believe it is public, because there is no documentation I worry about this breaking in a future WP release.
Next question is: Is this just a missing documentation entry or should I avoid this method like the plague? If it is a case of the documentation missing, is it possible for me to add the entry?
Thanks for reading this book :-X
- The topic ‘wp_delete_post / wp_trash_post’ is closed to new replies.