首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >自定义帖子类型中,帖子状态不是从发布到草稿、发布到挂起

自定义帖子类型中,帖子状态不是从发布到草稿、发布到挂起
EN

Stack Overflow用户
提问于 2015-02-23 05:16:50
回答 2查看 1.3K关注 0票数 0

我有一个自定义的帖子类型,其中我有一个问题,它的帖子状态始终保持为发布。每当我选择status draft或pending review,然后单击update按钮。它再次将post状态显示为publish,并且不会更改。请看下面的代码,并告诉我哪里出错了。

代码语言:javascript
复制
add_action('init', 'properties_create_post_type');

function properties_create_post_type() {

$soto_property_labels = array(
    'name' => __('Properties', 'custom'),
    'singular_name' => __('Property', 'custom'),
    'add_new' => __('Add New Property', 'custom'),
    'add_new_item' => __('Add New Property', 'custom'),
    'edit_item' => __('Edit Property', 'custom'),
    'new_item' => __('New Property', 'custom'),
    'all_items' => __('All Properties', 'custom'),
    'view_item' => __('View Property', 'custom'),
    'search_items' => __('Search Property', 'custom'),
    'not_found' => __('No Properties found', 'custom'),
    'not_found_in_trash' => __('No Properties found in Trash', 'custom'),
    'parent_item_colon' => '',
    'menu_name' => __('Properties', 'custom'),
);

register_post_type('soto_property',
    array(
        'labels' => $soto_property_labels,
        'supports' => array('title'),
        'public' => TRUE,
        'has_archive' => TRUE,
        'rewrite' => array('slug' => __('properties', 'custom')),
        'menu_icon' => plugins_url('properties/assets/img/properties.png'),
        'menu_position' => 42,
        'categories' => array(),
    )
); 
}
EN

回答 2

Stack Overflow用户

发布于 2015-03-06 00:00:45

我已经在我的网站上测试了你的代码,我没有看到任何问题,我可以将帖子状态设置为我想要的任何内容,并正确更新它。因此,您的代码没有问题,而是其他东西有问题。

在按下更新按钮的同时,开发人员工具中是否出现任何错误?您是否检查过服务器日志文件中的错误?

票数 0
EN

Stack Overflow用户

发布于 2015-03-06 05:15:02

你应该做的是:

单击Save Draft创建帖子,即

  1. 如果已发布,Save Draft菜单将消失,并显示Update按钮。然后,如果您想要更改DraftPending Review,请单击edit status的下拉列表。从下拉列表中选择DraftPending Review。单击ok,Update.
  2. Then Save DraftSave as Pending按钮将出现在图像的位置(我在这里附加了红色circle).
  3. Then,单击Save DraftSave as Pending按钮。

这是在发布后将任何帖子UpdateDraftPending Review的方法。但是,如果你已经收到了,让我知道,我会发送更多的截图。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/28663357

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档