wp_trash_post_comments [ WordPress Function ]
wp_trash_post_comments ( $post = null )
| Parameters: |
|
| Uses: | |
| Returns: |
|
| Defined at: |
|
Benzer Fonksiyonlar: wp_untrash_post_comments, wp_trash_comment, wp_untrash_comment, wp_list_comments, wp_trash_post
Moves comments for a post to the trash
Source
<?php
function wp_trash_post_comments($post = null) {
global $wpdb;
$post = get_post($post);
if ( empty($post) )
return;
$post_id = $post->ID;
do_action('trash_post_comments', $post_id);
$comments = $wpdb->get_results( $wpdb->prepare("SELECT comment_ID, comment_approved FROM $wpdb->comments WHERE comment_post_ID = %d", $post_id) );
if ( empty($comments) )
return;
// Cache current status for each comment
$statuses = array();
foreach ( $comments as $comment )
$statuses[$comment->comment_ID] = $comment->comment_approved;
add_post_meta($post_id, '_wp_trash_meta_comments_status', $statuses);
// Set status for all comments to post-trashed
$result = $wpdb->update($wpdb->comments, array('comment_approved' => 'post-trashed'), array('comment_post_ID' => $post_id));
clean_comment_cache( array_keys($statuses) );
do_action('trashed_post_comments', $post_id, $statuses);
return $result;
}
?>
Examples [ wp-snippets.com ]
Google Arama Sonuçlarý
- wp_trash_post_comments() WordPress function reference ...
Source. function wp_trash_post_comments($post = null) { global $wpdb; $post = get_post($post); if ( empty($post) ) return; $post_id = $post->ID; ...
queryposts.com - wp_trash_post() WordPress function reference, arguments and ...
... time()); $post['post_status'] = 'trash'; wp_insert_post($post); wp_trash_post_comments($post_id); do_action('trashed_post', $post_id); return $post; } ...
queryposts.com - wp_trash_post (WordPress Function) - WPSeek.com
add_post_meta($post_id,'_wp_trash_meta_time', time()); $post['post_status'] = ' trash'; wp_insert_post($post); wp_trash_post_comments($post_id); ...
wpseek.com - actions - Is there a recover_post hook to go with trash_post hook ...
May 4, 2012... time()); $post['post_status'] = 'trash'; wp_insert_post($post); wp_trash_post_comments($post_id); do_action('trashed_post', $post_id);. So .
wordpress.stackexchange.com