重写帖子重定向不适用于自定义帖子状态

时间:2017-05-31 01:58:01

标签: php wordpress redirect slug

我有一个带重写规则的自定义帖子类型:

$args = array( 'labels'         => $labels,
    'public'        => true,
    'publicly_queryable' => true,
    'exclude_from_search' => false,
    'show_ui'       => true,
    'show_in_menu'  => false,
    'rewrite'       => array( 'slug' => 'homework-tasks'),
    'hierarchical'  => TRUE,
    'capabilities'  => array( 'edit_post'=>'edit_emails',
    'read_post'=>'edit_emails', 'delete_post'=>'delete_emails' ),
    'supports'      => array( 'title','editor','revisions', 'comments' ),
);
register_post_type ( 'homework', $args);

自定义帖子状态:

            register_post_status( 'for_checking', [
                'public' => true
            ]);

问题是,具有新状态(for_checking)的帖子不会重定向为:

mysite.com/homework/post-name
->
mysite.com/homework-tasks/post-name

0 个答案:

没有答案