Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




wp_get_post_revisions [ WordPress Function ]

wp_get_post_revisions ( $post_id = 0, $args = null )
Parameters:
  • (int|object) $post_id Post ID or post object
Uses:
Returns:
  • (array) empty if no revisions
Defined at:



Returns all revisions of specified post.

Source


<?php
function wp_get_post_revisions$post_id 0$args null ) {
    if ( ! 
WP_POST_REVISIONS )
        return array();
    if ( ( !
$post get_post$post_id ) ) || empty( $post->ID ) )
        return array();

    
$defaults = array( 'order' => 'DESC''orderby' => 'date' );
    
$args wp_parse_args$args$defaults );
    
$args array_merge$args, array( 'post_parent' => $post->ID'post_type' => 'revision''post_status' => 'inherit' ) );

    if ( !
$revisions get_children$args ) )
        return array();
    return 
$revisions;
}
?>

Examples [ wp-snippets.com ]

Top Google zoekresultaten

Meer ...

Gebruikersdiscussies [ wordpress.org ]

0 User Note(s)

Nog geen één. Wees de eerste!

Nieuw toevoegen ...



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