Switch language

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




_wp_put_post_revision [ WordPress Function ]

_wp_put_post_revision ( $post = null, $autosave = false )
Parameters:
  • (int|object|array) $post Post ID, post object OR post array.
  • (bool) $autosave Optional. Is the revision an autosave?
Uses:
Returns:
  • (mixed) Null or 0 if error, new revision ID if success.
Defined at:



Inserts post data into the posts table as a post revision.

Source


<?php
function _wp_put_post_revision$post null$autosave false ) {
    if ( 
is_object($post) )
        
$post get_object_vars$post );
    elseif ( !
is_array($post) )
        
$post get_post($postARRAY_A);
    if ( !
$post || empty($post['ID']) )
        return;

    if ( isset(
$post['post_type']) && 'revision' == $post['post_type'] )
        return new 
WP_Error'post_type'__'Cannot create a revision of a revision' ) );

    
$post _wp_post_revision_fields$post$autosave );
    
$post add_magic_quotes($post); //since data is from db

    
$revision_id wp_insert_post$post );
    if ( 
is_wp_error($revision_id) )
        return 
$revision_id;

    if ( 
$revision_id )
        
do_action'_wp_put_post_revision'$revision_id );
    return 
$revision_id;
}
?>

Examples [ wp-snippets.com ]

Google Arama Sonuçlarý

Dahasý ...

Kullanýcý Tartýþmalarý [ wordpress.org ]

- Bulunamadý -

Yeni bir konu yaz ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



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