当前位置: 首页>>代码示例>>PHP>>正文


PHP wp_write_post函数代码示例

本文整理汇总了PHP中wp_write_post函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_write_post函数的具体用法?PHP wp_write_post怎么用?PHP wp_write_post使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了wp_write_post函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: write_post

function write_post() {
	$result = wp_write_post();
	if( is_wp_error( $result ) )
		wp_die( $result->get_error_message() );
	else
		return $result;
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:7,代码来源:admin-functions.php

示例2: __

 $do_autosave = (bool) $_POST['autosave'];
 $do_lock = true;
 $data = '';
 /* translators: draft saved date format, see http://php.net/date */
 $draft_saved_date_format = __('g:i:s a');
 $message = sprintf(__('Draft Saved at %s.'), date_i18n($draft_saved_date_format));
 $supplemental = array();
 if (isset($login_grace_period)) {
     $supplemental['session_expired'] = add_query_arg('interim-login', 1, wp_login_url());
 }
 $id = $revision_id = 0;
 if ($_POST['post_ID'] < 0) {
     $_POST['post_status'] = 'draft';
     $_POST['temp_ID'] = $_POST['post_ID'];
     if ($do_autosave) {
         $id = wp_write_post();
         $data = $message;
     }
 } else {
     $post_ID = (int) $_POST['post_ID'];
     $_POST['ID'] = $post_ID;
     $post = get_post($post_ID);
     if ($last = wp_check_post_lock($post->ID)) {
         $do_autosave = $do_lock = false;
         $last_user = get_userdata($last);
         $last_user_name = $last_user ? $last_user->display_name : __('Someone');
         $data = new WP_Error('locked', sprintf($_POST['post_type'] == 'page' ? __('Autosave disabled: %s is currently editing this page.') : __('Autosave disabled: %s is currently editing this post.'), esc_html($last_user_name)));
         $supplemental['disable_autosave'] = 'disable';
     }
     if ('page' == $post->post_type) {
         if (!current_user_can('edit_page', $post_ID)) {
开发者ID:nagyist,项目名称:laura-wordpress,代码行数:31,代码来源:admin-ajax.php

示例3: check_for_submitted

 function check_for_submitted()
 {
     if (!$_POST['cwp_submitted_' . $this->get_page_id()]) {
         return false;
     }
     do_action('cwp_submitted_' . $this->get_page_id());
     if ($_POST['post_ID'] > 0) {
         $mode = 'edit';
     } else {
         $mode = 'new';
     }
     include_once ABSPATH . '/wp-admin/includes/post.php';
     if ($mode === 'edit') {
         $post_id = edit_post($_POST);
     } else {
         $post_id = wp_write_post($_POST);
     }
     $post = get_post($post_id);
     foreach ($this->meta_boxes as $box) {
         if (function_exists($function = $box[2] . '_submitted')) {
             call_user_func($function, $post, $box[5]);
         }
     }
     $message = $mode === 'edit' ? 1 : 6;
     $message = $_POST['post_status'] === 'pending' ? 7 : $message;
     wp_redirect(add_query_arg('p', $post_id, add_query_arg('message', $message)));
     exit;
     foreach ((array) $this->meta_boxes as $meta_box) {
         if (function_exists($meta_box[3])) {
         }
     }
 }
开发者ID:adamcarlile,项目名称:Alex-Goy,代码行数:32,代码来源:cwp.classes.php


注:本文中的wp_write_post函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。