Forum Replies Created

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter tempcode

    (@tempcode)

    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.

    Thread Starter tempcode

    (@tempcode)

    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?

    Thread Starter tempcode

    (@tempcode)

    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

    Thread Starter tempcode

    (@tempcode)

    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?

    Thread Starter tempcode

    (@tempcode)

    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.

    Thread Starter tempcode

    (@tempcode)

    P.S. I’m using ‘mqTranslate’ to add multilanguage support on my wordpress site

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