Upgraded to 3.2 from 3.1 and lost the featured image panel in admin that was running in a custom post type.
add_action( 'init', 'create_my_post_types' );
function create_my_post_types() {
register_post_type( 'header_image_gallery',
array(
'labels' => array(
'name' => __( 'Header Images' ),
'singular_name' => __( 'Header Image' ),
'add_new' => __( 'Add New' ),
'add_new_item' => __( 'Add New Header Image' ),
'edit' => __( 'Edit' ),
'edit_item' => __( 'Edit Header Image' ),
'new_item' => __( 'New Header Image' ),
'view' => __( 'View Header Images' ),
'view_item' => __( 'View Header Images' ),
'search_items' => __( 'Search Header Images' ),
'not_found' => __( 'No Header Images found' ),
'not_found_in_trash' => __( 'No Header Images found in Trash' ),
'parent' => __( 'Parent Header Images' ),
),
'public' => true,
'supports' => array('title','thumbnail','revisions')
)
);
}
Post thumbnails are registered like so:
// This theme uses post thumbnails
add_theme_support( 'post-thumbnails', array('post', 'page') );
Note: The custom posts that were created prior to upgrade work properly on the frontend showing their post thumbnails (just the featured image admin panel is missing).
Also: I’ve gone to the codex and pulled the example custom post type, you’ll notice it should show a featured image > but also does not.
add_action('init', 'codex_custom_init');
function codex_custom_init()
{
$labels = array(
'name' => _x('Books', 'post type general name'),
'singular_name' => _x('Book', 'post type singular name'),
'add_new' => _x('Add New', 'book'),
'add_new_item' => __('Add New Book'),
'edit_item' => __('Edit Book'),
'new_item' => __('New Book'),
'all_items' => __('All Books'),
'view_item' => __('View Book'),
'search_items' => __('Search Books'),
'not_found' => __('No books found'),
'not_found_in_trash' => __('No books found in Trash'),
'parent_item_colon' => '',
'menu_name' => 'Books'
);
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => true,
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => false,
'menu_position' => null,
'supports' => array('title','editor','author','thumbnail','excerpt','comments')
);
register_post_type('book',$args);
}
If I examine the screen options no featured image option is visible in either example.
* Answered my own question
Perhaps in WP 3.1 you did not have to declare your custom post type when adding theme support but in WP 3.2 you do!
// This theme uses post thumbnails
add_theme_support( 'post-thumbnails', array('post', 'page','header_image_gallery') );
Change this:
To this:
The problem is that the array is explicit, when used. So, post-thumbnail support will only be added to post-types included in the array.
Omit the array, in order to add Theme support for post thumbnails universally.
Try this , It works for me.
Find this code on functions.php
Change the code to
This solution can be done if you created custom post type in functions.php