[wp-trac] [WordPress Trac] #11470: Don't have wp_delete_post and wp_delete_attachment trash the item by default

WordPress Trac wp-trac at lists.automattic.com
Thu Dec 17 16:00:12 UTC 2009


#11470: Don't have wp_delete_post and wp_delete_attachment trash the item by
default
--------------------------+-------------------------------------------------
 Reporter:  nacin         |       Owner:              
     Type:  defect (bug)  |      Status:  new         
 Priority:  normal        |   Milestone:  2.9         
Component:  Trash         |     Version:  2.9         
 Severity:  normal        |    Keywords:  dev-feedback
--------------------------+-------------------------------------------------

Comment(by nacin):

 I take back some previous comments. wp_delete_comment() does call
 wp_trash_comment() -- in fact, there is no $force_delete override if trash
 is enabled.

 {{{
         if (wp_get_comment_status($comment_id) != 'trash' &&
 wp_get_comment_status($comment_id) != 'spam' && EMPTY_TRASH_DAYS > 0)
                 return wp_trash_comment($comment_id);
 }}}

 Patch attached to continue the discussion. This reduces the
 wp_trash_(post|comment) functions to wrappers for the wp_delete_*
 functions. wp_delete_* will trash the item if the situation warrants.
 wp_trash_attachment will be handled in #11455.

 The only issue I see is this. I understand that calling wp_delete_* on a
 trashed item should delete it. But should calling wp_trash_* on a trashed
 item delete it as well? Perhaps a check couldn't hurt. Or, we treat these
 as strict wrappers and don't do a check, such that calling wp_trash_* on a
 trashed item will permanently delete the item. (Until now, wp_trash_* did
 not delete an already trashed item.)

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/11470#comment:10>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list