Title: tempcode's Replies | WordPress.org

---

# tempcode

  [  ](https://wordpress.org/support/users/tempcode/)

 *   [Profile](https://wordpress.org/support/users/tempcode/)
 *   [Topics Started](https://wordpress.org/support/users/tempcode/topics/)
 *   [Replies Created](https://wordpress.org/support/users/tempcode/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/tempcode/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/tempcode/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/tempcode/engagements/)
 *   [Favorites](https://wordpress.org/support/users/tempcode/favorites/)

 Search replies:

## Forum Replies Created

Viewing 6 replies - 1 through 6 (of 6 total)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Events Manager - Calendar, Bookings, Tickets, and more!] Themify Landing vs. Events Manager on WP 5.1.1](https://wordpress.org/support/topic/themify-landing-vs-events-manager-on-wp-5-1-1/)
 *  Thread Starter [tempcode](https://wordpress.org/support/users/tempcode/)
 * (@tempcode)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/themify-landing-vs-events-manager-on-wp-5-1-1/#post-11338200)
 * Sorry but I don’t know, because it’s not completely clear when the Themify themes/
   plugins are updated when use the Themify updater and the issue was notified by
   the user that use this site (and he use not too much the site).
 * Last update of the Events manager plugin it’s about 3 week ago.
 * Surely when I disable the landing theme with the WP Safe Mode plugin, the Events
   manager plugin start to work correcly.
 * I don’t have an error message, seems one plugin use the same priority or overwrite
   something of the other plugin and the Events manager plugin can’t save it’s post
   type.
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Create custom post type in plugin code. Invalid post type page and next…puf](https://wordpress.org/support/topic/create-custom-post-type-in-plugin-code-invalid-post-type-page-and-nextpuf/)
 *  Thread Starter [tempcode](https://wordpress.org/support/users/tempcode/)
 * (@tempcode)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/create-custom-post-type-in-plugin-code-invalid-post-type-page-and-nextpuf/#post-7659736)
 * Doh!
 * > register_post_type() needs to be called on every page load. It’s not like
 * Jacob you have saved me. Thank you very much!
 * It’s not a strange think to register a custom post type on every page load?
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Create custom post type in plugin code. Invalid post type page and next…puf](https://wordpress.org/support/topic/create-custom-post-type-in-plugin-code-invalid-post-type-page-and-nextpuf/)
 *  Thread Starter [tempcode](https://wordpress.org/support/users/tempcode/)
 * (@tempcode)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/create-custom-post-type-in-plugin-code-invalid-post-type-page-and-nextpuf/#post-7659734)
 * this is my last custom post type definition:
 *     ```
       public function create_custom_post_type(){
        $status = get_option($this->status, -1);
        $post_id = get_option ( $this->page_id, - 1 );
        if ($post_id == - 1 && $status == -1) {
         $labels = array(
         'name' => _x( 'CGL', 'Post Type General Name', $this->plugin_name ),
         'singular_name' => _x( 'CGL', 'Post Type Singular Name', $this->plugin_name ),
         'menu_name' => __( 'CGL', $this->plugin_name ),
         'name_admin_bar'        => __( 'CGL', $this->plugin_name ),
         'archives'  => __( 'Item Archives', $this->plugin_name ),
         'parent_item_colon'     => __( 'Parent Item:', $this->plugin_name ),
         'all_items' => __( 'All Items', $this->plugin_name ),
         'add_new_item'          => __( 'Add New Item', $this->plugin_name ),
         'add_new'   => __( 'Add New', $this->plugin_name ),
         'new_item'  => __( 'New Item', $this->plugin_name ),
         'edit_item' => __( 'Edit Item', $this->plugin_name ),
         'update_item'           => __( 'Update Item', $this->plugin_name ),
         'view_item' => __( 'View Item', $this->plugin_name ),
         'search_items'          => __( 'Search Item', $this->plugin_name ),
         'not_found' => __( 'Not found', $this->plugin_name ),
         'not_found_in_trash' => __( 'Not found in Trash', $this->plugin_name ),
         'featured_image' => __( 'Featured Image', $this->plugin_name ),
         'set_featured_image' => __( 'Set featured image', $this->plugin_name ),
         'remove_featured_image' => __( 'Remove featured image', $this->plugin_name ),
         'use_featured_image' => __( 'Use as featured image', $this->plugin_name ),
         'insert_into_item' => __( 'Insert into item', $this->plugin_name ),
         'uploaded_to_this_item' => __( 'Uploaded to this item', $this->plugin_name ),
         'items_list' => __( 'Items list', $this->plugin_name ),
         'items_list_navigation' => __( 'Items list navigation', $this->plugin_name ),
         'filter_items_list' => __( 'Filter items list', $this->plugin_name ),
       			);
         $args = array(
         'label'     => __( 'CGL', $this->plugin_name ),
         'description'           => __( '', $this->plugin_name ),
         'labels'    => $labels,
         //'supports'  => array( 'title', 'editor'), //ok
         //'taxonomies'            => array( 'category', 'post_tag' ),
         //'hierarchical'          => true,//non serve
         'public'    => true,//true,
         'show_ui'   => true,//true,
         'show_in_menu'          => true,//true,
         'menu_position'         => 20,
         'show_in_admin_bar'     => true,//true,
         'show_in_nav_menus'     => true,//true,
         'can_export'            => true,
         'has_archive'           => false,
         'exclude_from_search'   => true,//ok
         'publicly_queryable'    => true,//ok
         'rewrite'   => false,//from default page config
         'query_var'  			=> false,//ok
         'capability_type'       => 'page',
       			);
   
         $res=register_post_type( 'carriergem', $args );
        }
       }
       ```
   
 * the function **create_custom_post_type** is called in **init action hook** with
   priority 0.
 * **Every kind** of post I create by using of the function wp_insert_post make 
   the custom type disappear from the wp-admin menu.
 * This is the last code I use, in the **wp_loaded action hook**, for post creation:
 *     ```
       public function create_custom_page(){
         // create page for plugin
         $status = get_option($this->status, -1);
         $post_id = get_option ( $this->page_id, - 1 );
         if ($post_id == - 1 && $status == -1) {
           // register page
   
       	$post = array (
       	'comment_status' => 'closed',
       	'ping_status' => 'closed',
       	'post_author' => 1,
        	'post_date' => date ( 'Y-m-d H:i:s', current_time( 'timestamp', 0 )),
        	'post_date_gmt' => date ( 'Y-m-d H:i:s', current_time( 'timestamp', 1 )),
        	'post_modified' => date ( 'Y-m-d H:i:s', current_time( 'timestamp', 0 )),
        	'post_modified_gmt' => gmdate ( 'Y-m-d H:i:s', current_time( 'timestamp', 1 )),
        	'post_name' => 'carriergem-linker',
        	//'post_status' => 'publish',
        	'post_title' => '',
        	'post_content' => '',
        	'post_parent' => 0,
        	'menu_order' => 0,
        	'comment_count' => 0,
        	'post_type' => 'carriergem', // 'page',
       	);
       	$post_id = wp_insert_post ( $post , true);
       	//add_post_meta( $post_id, '_edit_last', 1 );
       	//add_post_meta( $post_id, '_edit_lock', current_time( 'timestamp', 0 ).':1' );
       	carriergem_log_me ( $post_id );
       	add_option ( $this->page_id, $post_id );
   
       	}
       }
       ```
   
 * No error in the wordpress debug file…I don’t know what is wrong
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Create custom post type in plugin code. Invalid post type page and next…puf](https://wordpress.org/support/topic/create-custom-post-type-in-plugin-code-invalid-post-type-page-and-nextpuf/)
 *  Thread Starter [tempcode](https://wordpress.org/support/users/tempcode/)
 * (@tempcode)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/create-custom-post-type-in-plugin-code-invalid-post-type-page-and-nextpuf/#post-7659729)
 * OK, I’ve done another test and I’ve seen that the problem is not in custom post
   type creation (now I’ve fixed and improved the code of custom post type creation)
   but the issue is in the post type insertion.
 * I’ve set the wp_error parameter to true but the wp_insert_post doesn’t give me
   a feedback about any anomalies.
 * Where I do it wrong?
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Create custom post type in plugin code. Invalid post type page and next…puf](https://wordpress.org/support/topic/create-custom-post-type-in-plugin-code-invalid-post-type-page-and-nextpuf/)
 *  Thread Starter [tempcode](https://wordpress.org/support/users/tempcode/)
 * (@tempcode)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/create-custom-post-type-in-plugin-code-invalid-post-type-page-and-nextpuf/#post-7659716)
 * I’ve created a clean installation of wordpress 4.5.3 and in the new installation
   the issue is come again…please help me!
 * I can’t understand where my code fail or where it create this issue.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Sendit WP Newsletter] SendIt – Mulilanguage: email subject with strange character ()](https://wordpress.org/support/topic/sendit-mulilanguage-email-subject-with-strange-character/)
 *  Thread Starter [tempcode](https://wordpress.org/support/users/tempcode/)
 * (@tempcode)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/sendit-mulilanguage-email-subject-with-strange-character/#post-5667551)
 * P.S. I’m using ‘mqTranslate’ to add multilanguage support on my wordpress site

Viewing 6 replies - 1 through 6 (of 6 total)