Switch language

wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren




wp_untrash_post [ WordPress Function ]

wp_untrash_post ( $post_id = 0 )
Parameter:
  • (int) $post_id Post ID.
Nutzt:
Gibt zurück:
  • (mixed) False on failure
Definiert in:



Restores a post or page from the Trash

Source


<?php
function wp_untrash_post($post_id 0) {
    if ( !
$post wp_get_single_post($post_idARRAY_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;
}
?>

Beispiele [ wp-snippets.com ]

Top Google Suchergebnisse

Mehr ...

Nutzerduskussionen [ wordpress.org ]

0 Nutzerkommentare

Noch keine. Sei der Erste!

Neu hinzufügen ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics