wp_untrash_post [ WordPress Function ]
wp_untrash_post ( $post_id = 0 )
| Parameters: |
|
| Uses: | |
| Returns: |
|
| Defined at: |
|
Similar Functions: wp_trash_post, wp_ajax_untrash_post, wp_ajax_trash_post, wp_untrash_comment, wp_untrash_post_comments
Restores a post or page from the Trash
Source
<?php
function wp_untrash_post($post_id = 0) {
if ( !$post = wp_get_single_post($post_id, ARRAY_A) )
return $post;
if ( $post['post_status'] != 'trash' )
return false;
do_action('untrash_post', $post_id);
$post_status = get_post_meta($post_id, '_wp_trash_meta_status', true);
$post['post_status'] = $post_status;
delete_post_meta($post_id, '_wp_trash_meta_status');
delete_post_meta($post_id, '_wp_trash_meta_time');
wp_insert_post($post);
wp_untrash_post_comments($post_id);
do_action('untrashed_post', $post_id);
return $post;
}
?>
Examples [ wp-snippets.com ]
Top Google Search Results
- wp_untrash_post (WordPress Function) - WPSeek.com
WordPress lookup for wp_untrash_post, a WordPress Function. wpseek.com is a WordPress-centric search tool for developers and theme authors.
wpseek.com - wp_untrash_post() WordPress function reference, arguments and ...
function wp_untrash_post($post_id = 0) { if ( !$post = wp_get_single_post($ post_id, ARRAY_A) ) return $post; if ( $post['post_status'] != 'trash' ) return false ...
queryposts.com - Inconsistency between save_post and trash_post - WordPress
So, to confirm, you recommend I use wp_delete_post and wp_untrash_post ... Sharing your pain here ;) I think I'd use wp_trash_post and wp_untrash_post, ...
wordpress.org - actions - Is there a recover_post hook to go with trash_post hook ...
May 4, 2012 ... function wp_untrash_post($post_id = 0) { if ( ! ... When a post is untrashed, WordPress calls wp_untrash_post . That calls two actions: ...
wordpress.stackexchange.com