I use a plugin that has a custom post type and when I publish a post it is displayed on a single page but when the post is automatically published using an author's robot plugin, unfortunately, the single page is not found and shows error 404!!
//------------------------
//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 );
}
I have the main plugin file with this function:
public function init_hooks() {
register_activation_hook( __FILE__, array( 'IWJ_active', 'activate' ) );
}
Then within my class, I have this:
static function activate() {
IWJ_Post_Types::register_post_types();
flush_rewrite_rules();
}
I don't know why when I use the Author Robot Plugin for publishing a post, custom post type single page not found?? but it works when I manually update it again!