• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP post_preview函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: wtb_seo_api_callback

 /**
  * ajax plugin api, to check info of content
  */
 function wtb_seo_api_callback()
 {
     $json = array();
     $postCopy = $_POST;
     // hack for create autosave
     if (0) {
         // exclude for short time, to find out
         // why sometimes post_preview() trows wordpress error
         $post_ID = (int) $_POST['post']['post_ID'];
         $status = get_post_status($post_ID);
         if ('auto-draft' != $status) {
             $_POST = $_POST['post'];
             post_preview();
         }
     }
     // end of hack
     $wpSlot = new wtb_seo_calculator($postCopy);
     $json['box'] = $wpSlot->generateBox()->render();
     echo json_encode($json);
     die;
     // this is required to return a proper result
 }
开发者ID:repupress,项目名称:onpage-post-seo-wordpress-plugin,代码行数:25,代码来源:actions.php


示例2: wp_die

     }
     if ($post->post_type == 'attachment') {
         $force = !MEDIA_TRASH;
         if (!wp_delete_attachment($post_id, $force)) {
             wp_die(__('Error in deleting.'));
         }
     } else {
         if (!wp_delete_post($post_id, true)) {
             wp_die(__('Error in deleting.'));
         }
     }
     wp_redirect(add_query_arg('deleted', 1, $sendback));
     exit;
 case 'preview':
     check_admin_referer('update-post_' . $post_id);
     $url = post_preview();
     wp_redirect($url);
     exit;
 default:
     /**
      * Fires for a given custom post action request.
      *
      * The dynamic portion of the hook name, `$action`, refers to the custom post action.
      *
      * @since 4.6.0
      *
      * @param int $post_id Post ID sent with the request.
      */
     do_action("post_action_{$action}", $post_id);
     wp_redirect(admin_url('edit.php'));
     exit;
开发者ID:pbearne,项目名称:contrib2core,代码行数:31,代码来源:post.php


示例3: form_handler

 public function form_handler()
 {
     if (isset($_POST['post_ID'])) {
         require_once ABSPATH . '/wp-admin/includes/post.php';
         $action = isset($_POST['action']) ? $_POST['action'] : '';
         if (isset($_GET['post'])) {
             $post_id = $post_ID = (int) $_GET['post'];
         } elseif (isset($_POST['post_ID'])) {
             $post_id = $post_ID = (int) $_POST['post_ID'];
         } else {
             $post_id = $post_ID = 0;
         }
         $post = $post_type = $post_type_object = null;
         if ($post_id) {
             $post = get_post($post_id);
         }
         if ($post) {
             $post_type = $post->post_type;
             $post_type_object = get_post_type_object($post_type);
         }
         if (isset($_POST['deletepost'])) {
             $action = 'delete';
         } elseif (isset($_POST['wp-preview']) && 'dopreview' == $_POST['wp-preview']) {
             $action = 'preview';
         }
         $sendback = wp_get_referer();
         if (!$sendback || strpos($sendback, 'post.php') !== false || strpos($sendback, 'post-new.php') !== false) {
             if ('attachment' == $post_type) {
                 $sendback = admin_url('upload.php');
             } else {
                 $sendback = admin_url('edit.php');
                 $sendback .= !empty($post_type) ? '?post_type=' . $post_type : '';
             }
         } else {
             $sendback = remove_query_arg(array('trashed', 'untrashed', 'deleted', 'ids'), $sendback);
         }
         switch ($action) {
             case 'postajaxpost':
             case 'post':
                 check_admin_referer('add-' . $post_type);
                 $post_id = 'postajaxpost' == $action ? edit_post() : write_post();
                 $this->redirect_post($post_id);
                 exit;
                 break;
             case 'editpost':
                 wp_verify_nonce('update-post_' . $post_id);
                 $post_id = edit_post();
                 // Session cookie flag that the post was saved
                 if (isset($_COOKIE['wp-saving-post-' . $post_id])) {
                     setcookie('wp-saving-post-' . $post_id, 'saved');
                 }
                 $this->redirect_post($post_id);
                 // Send user on their way while we keep working
                 exit;
                 break;
             case 'trash':
                 check_admin_referer('trash-post_' . $post_id);
                 if (!$post) {
                     wp_die(__('The item you are trying to move to the Trash no longer exists.'));
                 }
                 if (!$post_type_object) {
                     wp_die(__('Unknown post type.'));
                 }
                 if (!current_user_can('delete_post', $post_id)) {
                     wp_die(__('You are not allowed to move this item to the Trash.'));
                 }
                 if ($user_id = wp_check_post_lock($post_id)) {
                     $user = get_userdata($user_id);
                     wp_die(sprintf(__('You cannot move this item to the Trash. %s is currently editing.'), $user->display_name));
                 }
                 if (!wp_trash_post($post_id)) {
                     wp_die(__('Error in moving to Trash.'));
                 }
                 wp_redirect(add_query_arg(array('trashed' => 1, 'ids' => $post_id), $sendback));
                 exit;
                 break;
             case 'preview':
                 check_admin_referer('update-post_' . $post_id);
                 $url = post_preview();
                 wp_redirect($url);
                 exit;
                 break;
         }
         // end switch
     }
 }
开发者ID:VadimSid,项目名称:thinkgreek,代码行数:86,代码来源:class-bon-front-end-editor.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP post_redirect函数代码示例发布时间:2022-05-15
下一篇:
PHP post_permalink函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap