Changeset 13995 for trunk/wp-includes/comment.php
- Timestamp:
- 04/04/2010 12:20:19 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/comment.php
r13937 r13995 857 857 858 858 /** 859 * Removes comment ID and maybe updates post comment count. 859 * Trashes or deletes a comment. 860 * 861 * The comment is moved to trash instead of permanently deleted unless trash is 862 * disabled, item is already in the trash, or $force_delete is true. 860 863 * 861 864 * The post comment count will be updated if the comment was approved and has a … … 870 873 * 871 874 * @param int $comment_id Comment ID 875 * @param bool $force_delete Whether to bypass trash and force deletion. Default is false. 872 876 * @return bool False if delete comment query failure, true on success. 873 877 */ 874 function wp_delete_comment($comment_id ) {878 function wp_delete_comment($comment_id, $force_delete = false) { 875 879 global $wpdb; 876 880 if (!$comment = get_comment($comment_id)) 877 881 return false; 878 882 879 if ( wp_get_comment_status($comment_id) != 'trash' && wp_get_comment_status($comment_id) != 'spam' && EMPTY_TRASH_DAYS > 0)883 if ( !$force_delete && EMPTY_TRASH_DAYS && !in_array( wp_get_comment_status($comment_id), array( 'trash', 'spam' ) ) ) 880 884 return wp_trash_comment($comment_id); 881 885 … … 916 920 * Moves a comment to the Trash 917 921 * 922 * If trash is disabled, comment is permanently deleted. 923 * 918 924 * @since 2.9.0 919 925 * @uses do_action() on 'trash_comment' before trashing 920 926 * @uses do_action() on 'trashed_comment' after trashing 927 * @uses wp_delete_comment() if trash is disabled 921 928 * 922 929 * @param int $comment_id Comment ID. … … 924 931 */ 925 932 function wp_trash_comment($comment_id) { 926 if ( EMPTY_TRASH_DAYS == 0)927 return wp_delete_comment($comment_id );933 if ( !EMPTY_TRASH_DAYS ) 934 return wp_delete_comment($comment_id, true); 928 935 929 936 if ( !$comment = get_comment($comment_id) )
Note: See TracChangeset
for help on using the changeset viewer.