Make WordPress Core


Ignore:
Timestamp:
04/04/2010 12:20:19 PM (15 years ago)
Author:
nacin
Message:

Add $force_delete to wp_delete_comment(). see #12766, see #11470.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/post.php

    r13985 r13995  
    15931593
    15941594/**
    1595  * Removes a post, attachment, or page.
    1596  *
    1597  * When the post and page goes, everything that is tied to it is deleted also.
     1595 * Trashes or deletes a post or page.
     1596 *
     1597 * When the post and page is permanently deleted, everything that is tied to it is deleted also.
    15981598 * This includes comments, post meta fields, and terms associated with the post.
     1599 *
     1600 * The post or page is moved to trash instead of permanently deleted unless trash is
     1601 * disabled, item is already in the trash, or $force_delete is true.
    15991602 *
    16001603 * @since 1.0.0
     
    16021605 * @uses do_action() on 'deleted_post' after deletion unless post type is 'attachment'.
    16031606 * @uses wp_delete_attachment() if post type is 'attachment'.
     1607 * @uses wp_trash_post() if item should be trashed.
    16041608 *
    16051609 * @param int $postid Post ID.
    1606  * @param bool $force_delete Whether to bypass trash and force deletion
     1610 * @param bool $force_delete Whether to bypass trash and force deletion. Defaults to false.
    16071611 * @return mixed False on failure
    16081612 */
     
    16131617        return $post;
    16141618
    1615     if ( !$force_delete && ( $post->post_type == 'post' || $post->post_type == 'page') && get_post_status( $postid ) != 'trash' && EMPTY_TRASH_DAYS > 0 )
     1619    if ( !$force_delete && ( $post->post_type == 'post' || $post->post_type == 'page') && get_post_status( $postid ) != 'trash' && EMPTY_TRASH_DAYS )
    16161620            return wp_trash_post($postid);
    16171621
     
    16991703 * Moves a post or page to the Trash
    17001704 *
     1705 * If trash is disabled, the post or page is permanently deleted.
     1706 *
    17011707 * @since 2.9.0
    17021708 * @uses do_action() on 'trash_post' before trashing
    17031709 * @uses do_action() on 'trashed_post' after trashing
     1710 * @uses wp_delete_post() if trash is disabled
    17041711 *
    17051712 * @param int $postid Post ID.
     
    17071714 */
    17081715function wp_trash_post($post_id = 0) {
    1709     if ( EMPTY_TRASH_DAYS == 0 )
    1710         return wp_delete_post($post_id);
     1716    if ( !EMPTY_TRASH_DAYS )
     1717        return wp_delete_post($post_id, true);
    17111718
    17121719    if ( !$post = wp_get_single_post($post_id, ARRAY_A) )
     
    32973304
    32983305/**
    3299  * Delete an attachment.
    3300  *
    3301  * Will remove the file also, when the attachment is removed. Removes all post
    3302  * meta fields, taxonomy, comments, etc associated with the attachment (except
    3303  * the main post).
     3306 * Trashes or deletes an attachment.
     3307 *
     3308 * When an attachment is permanently deleted, the file will also be removed.
     3309 * Deletion removes all post meta fields, taxonomy, comments, etc. associated
     3310 * with the attachment (except the main post).
     3311 *
     3312 * The attachment is moved to the trash instead of permanently deleted unless trash
     3313 * for media is disabled, item is already in the trash, or $force_delete is true.
    33043314 *
    33053315 * @since 2.0.0
     
    33083318 *
    33093319 * @param int $postid Attachment ID.
    3310  * @param bool $force_delete Whether to bypass trash and force deletion
     3320 * @param bool $force_delete Whether to bypass trash and force deletion. Defaults to false.
    33113321 * @return mixed False on failure. Post data on success.
    33123322 */
Note: See TracChangeset for help on using the changeset viewer.