Note: I first asked this question on stackoverflow but didn't get an answer.

I created a plugin with a new custom post type, it works locally as it should but on one of my websites, which happens to be a multisite, it won't properly save when I add a new custom post item.

When I first try to publish it, it will still save as a draft and the meta box values are not being saved while I am using the save_post hook. Also I am always redirected to /wp-admin/post.php when I save instead of staying on the edit page like it normally does.

This is the custom post type code:

public function download_post_type() {
    $labels = array(
        'name' => _x('Downloads', 'post type general name'),
        'singular_name' => _x('Downloads', 'post type singular name'),
        'add_new' => _x('Add New', 'download'),
        'add_new_item' => __('Add New Download'),
        'edit_item' => __('Edit Download'),
        'new_item' => __('New Download'),
        'all_items' => __('All Downloads'),
        'view_item' => __('View Download'),
        'search_items' => __('Search Downloads'),
        'not_found' =>  __('No downloads found'),
        'not_found_in_trash' => __('No downloads found in Trash'), 
        'parent_item_colon' => '',
        'menu_name' => __('Downloads')
    $args = array(
        'labels' => $labels,
        'hierarchical' => false,
        'public' => true,
        'publicly_queryable' => true,
        'show_ui' => true, 
        'show_in_menu' => true, 
        'query_var' => true,
        'rewrite' => true,
        'menu_icon' => 'http://cdn1.iconfinder.com/data/icons/CrystalClear/16x16/apps/ark2.png',  
        'taxonomies' => array( 'category' ), 
        'capability_type' => 'post',
        'has_archive' => true, 
        'hierarchical' => true,
        'menu_position' => 5,
        'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'custom-fields', 'revisions' )

    register_post_type('downloads', $args);
  • 1
    Your code looks fine to me. try it only with wordpress default theme and with your plugin making sure other plugins doesn't creating the problem. Also can you share your save_postcode? – Sisir Apr 27 '13 at 8:09
  • 1
    I confirm. I pasted your code into TwentyTen and everything works as expected. – Fränk Apr 27 '13 at 8:11
  • Please add debugging information and check your server logs if you have access to them. – s_ha_dum Apr 27 '13 at 14:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.