Php 找不到自定义文章类型的单个页面
我使用一个插件,它有一个自定义的帖子类型,当我发布一篇帖子时,它会显示在一个页面上,但当帖子使用作者的机器人插件自动发布时,不幸的是,该页面没有找到,并显示错误404Php 找不到自定义文章类型的单个页面,php,wordpress,custom-post-type,Php,Wordpress,Custom Post Type,我使用一个插件,它有一个自定义的帖子类型,当我发布一篇帖子时,它会显示在一个页面上,但当帖子使用作者的机器人插件自动发布时,不幸的是,该页面没有找到,并显示错误404 //------------------------ //function init //------------------------- static function init(){ add_action( 'init', array( __CLASS__, 'register_post_types'
//------------------------
//function init
//-------------------------
static function init(){
add_action( 'init', array( __CLASS__, 'register_post_types' ) );
}
//------------------------
//register post type
//-------------------------
static function register_post_types(){
$labels = array(
//custom post type
);
$args = array(
'labels' => $labels,
'public' => true,
'show_ui' => true,
'hierarchical' => false,
'rewrite' => array('slug' => 'jobtest'),
'query_var' => true,
'has_archive' => true,
'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' )
);
register_post_type( 'iwj_job' , $args );
}
我有这个功能的主插件文件:
public function init_hooks() {
register_activation_hook( __FILE__, array( 'IWJ_active', 'activate' ) );
}
在我的课堂上,我有这样一个问题:
static function activate() {
IWJ_Post_Types::register_post_types();
flush_rewrite_rules();
}
我不知道为什么当我使用Author Robot插件发布帖子时,没有找到自定义帖子类型的单个页面??但当我再次手动更新它时,它就可以工作了 要修复找不到的自定义帖子,请在函数中使用以下代码。php:
flush_rewrite_rules( false );
以及,
只需进入设置>永久链接,并选择一个永久链接结构(如果您还没有这样做)。完成后,单击“保存更改”,并在提示时对.htaccess进行任何更改。现在再次查看您的自定义帖子,所有内容都应该是正确的。当我手动发布时,它可以工作,但当它通过robot插件发布时,它不工作