custom post type single page not found after aotumatic publish By the author’s robot

Question

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 a author’s robot plugin, unfortunately the single page is not found and shows error 404!!
My custom post type in the class is as follows:

<?php
/*------------------------
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 publish a post, custom post type single page not found?? but it works when I manually update it again!

0
, , mohsen 3 years 2019-10-10T11:09:07-05:00 0 Answers 113 views 0

Leave an answer

Browse
Browse