get_default_post_to_edit [ WordPress Function ]
get_default_post_to_edit ( $post_type = 'post', $create_in_db = false )
| Parameters: |
|
| Returns: |
|
| Defined at: |
|
Soorgelijke functies: get_default_page_to_edit, get_default_link_to_edit, get_post_to_edit, get_real_file_to_edit, get_tags_to_edit
Default post information to use when populating the "Write Post" form.
Source
<?php
function get_default_post_to_edit( $post_type = 'post', $create_in_db = false ) {
global $wpdb;
$post_title = '';
if ( !empty( $_REQUEST['post_title'] ) )
$post_title = esc_html( stripslashes( $_REQUEST['post_title'] ));
$post_content = '';
if ( !empty( $_REQUEST['content'] ) )
$post_content = esc_html( stripslashes( $_REQUEST['content'] ));
$post_excerpt = '';
if ( !empty( $_REQUEST['excerpt'] ) )
$post_excerpt = esc_html( stripslashes( $_REQUEST['excerpt'] ));
if ( $create_in_db ) {
$post_id = wp_insert_post( array( 'post_title' => __( 'Auto Draft' ), 'post_type' => $post_type, 'post_status' => 'auto-draft' ) );
$post = get_post( $post_id );
if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post->post_type, 'post-formats' ) && get_option( 'default_post_format' ) )
set_post_format( $post, get_option( 'default_post_format' ) );
} else {
$post = new stdClass;
$post->ID = 0;
$post->post_author = '';
$post->post_date = '';
$post->post_date_gmt = '';
$post->post_password = '';
$post->post_type = $post_type;
$post->post_status = 'draft';
$post->to_ping = '';
$post->pinged = '';
$post->comment_status = get_option( 'default_comment_status' );
$post->ping_status = get_option( 'default_ping_status' );
$post->post_pingback = get_option( 'default_pingback_flag' );
$post->post_category = get_option( 'default_category' );
$post->page_template = 'default';
$post->post_parent = 0;
$post->menu_order = 0;
}
$post->post_content = apply_filters( 'default_content', $post_content, $post );
$post->post_title = apply_filters( 'default_title', $post_title, $post );
$post->post_excerpt = apply_filters( 'default_excerpt', $post_excerpt, $post );
$post->post_name = '';
return $post;
}
?>
Examples [ wp-snippets.com ]
Top Google zoekresultaten
- get_default_post_to_edit (WordPress Function) - WPSeek.com
WordPress lookup for get_default_post_to_edit, a WordPress Function. wpseek. com is a WordPress-centric search tool for developers and theme authors.
wpseek.com - get_default_post_to_edit | A HitchHackers guide through WordPress
Feb 12, 2011 ... Source code. function get_default_post_to_edit( $post_type = 'post', $ create_in_db = false ) { global $wpdb; $post_title = ''; if ( !empty( ...
hitchhackerguide.com - get_default_post_to_edit
Function and Method Cross Reference. get_default_post_to_edit(). Defined at: / wp-admin/includes/post.php -> line 396. Referenced 9 times: ...
phpxref.ftwr.co.uk - WordPress › Support » Tags — get_default_post_to_edit
Forums. Username or Email Address Password (forgot?) Register · WordPress › Support » get_default_post_to_edit. Tag: get_default_post_to_edit Add New » ...
wordpress.org