Switch language

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




wp_ajax_wp_fullscreen_save_post [ WordPress Function ]

wp_ajax_wp_fullscreen_save_post ( No parameters )
Defined at:



No description yet.

Source


<?php
function wp_ajax_wp_fullscreen_save_post() {
    
$post_id = isset( $_POST['post_ID'] ) ? (int) $_POST['post_ID'] : 0;

    
$post $post_type null;

    if ( 
$post_id )
        
$post get_post$post_id );

    if ( 
$post )
        
$post_type $post->post_type;
    elseif ( isset( 
$_POST['post_type'] ) && post_type_exists$_POST['post_type'] ) )
        
$post_type $_POST['post_type'];

    
check_ajax_referer('update-' $post_type '_' $post_id'_wpnonce');

    
$post_id edit_post();

    if ( 
is_wp_error($post_id) ) {
        if ( 
$post_id->get_error_message() )
            
$message $post_id->get_error_message();
        else
            
$message __('Save failed');

        echo 
json_encode( array( 'message' => $message'last_edited' => '' ) );
        
wp_die();
    } else {
        
$message __('Saved.');
    }

    if ( 
$post ) {
        
$last_date mysql2dateget_option('date_format'), $post->post_modified );
        
$last_time mysql2dateget_option('time_format'), $post->post_modified );
    } else {
        
$last_date date_i18nget_option('date_format') );
        
$last_time date_i18nget_option('time_format') );
    }

    if ( 
$last_id get_post_meta($post_id'_edit_last'true) ) {
        
$last_user get_userdata($last_id);
        
$last_edited sprintf__('Last edited by %1$s on %2$s at %3$s'), esc_html$last_user->display_name ), $last_date$last_time );
    } else {
        
$last_edited sprintf__('Last edited on %1$s at %2$s'), $last_date$last_time );
    }

    echo 
json_encode( array( 'message' => $message'last_edited' => $last_edited ) );
    
wp_die();
}
?>

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