0

I'm probably missing something but somehow my custom post type doesn't display the featured image input field when creating the post. I have the featured image already registered in my functions.php and it does show up at pages and regular posts. But not at my custom post type.

This is the code that I've used to enable the featured images

add_theme_support('post-thumbnails');

And the code to register the custom post type

add_action( 'init', 'create_post_type' );
function create_post_type() {
register_post_type( 'vacature',
    array( 'labels' => array(
            'name' => __( 'Vacatures' ),
            'singular_name' => __( 'Vacature' ),
        ),
    'public' => true,
    'has_archive' => true,
    'supports' => array( 'title', 'editor', 'thumbnail', 'comments' ),
    )
    );
}
1
  • Your code for adding Featured image support is incorrect. Try this add_theme_support( 'post-thumbnails', array('post', 'page','vacature'));
    – Yatix
    Nov 5, 2014 at 17:22

2 Answers 2

2

Change this line

add_theme_support( 'post-thumbnails');

To

add_theme_support( 'post-thumbnails', array('post', 'page','vacature'));

I think this will help you.

0

Well i use some different kind of code, which make custom post, but it work perfectly. which save tags,category,freature image. Here is code, Hope fully its help you.

function my_custom_post_faq() {
    $labels = array(
        'name'               => _x( 'Slides', 'post type general name' ),
        'singular_name'      => _x( 'Slides', 'post type singular name' ),
        'add_new'            => _x( 'Add New', 'Slides' ),
        'add_new_item'       => __( 'Add New Slide' ),
        'edit_item'          => __( 'Edit Slide' ),
        'new_item'           => __( 'New Slide' ),
        'all_items'          => __( 'All Slides' ),
        'view_item'          => __( 'View Slides' ),
        'search_items'       => __( 'Search Slides' ),
        'not_found'          => __( 'No Slide found' ),
        'not_found_in_trash' => __( 'No Sliode found in the Trash' ), 
        'parent_item_colon'  => '',
        'menu_name'          => 'Slide'
    );
    $args = array(
        'labels'        => $labels,
        'description'   => 'Holds our Slides and Slide specific data',
        'public'        => true,
        'menu_position' => 5,
        'supports'      => array( 'title', 'editor', 'thumbnail', 'excerpt', 'comments' ),
        'has_archive'   => true,
    );
    register_post_type( 'faq', $args ); 
}
add_action( 'init', 'my_custom_post_faq' );


/*----------- For tags -------------*/

function my_taxonomies_faq() {
    $args = array();
    register_taxonomy( 'faq_category', 'faq', $args );
}

add_action( 'init', 'my_taxonomies_faq', 0 );




/*----------- For categories -------------*/

function my_taxonomies_faq_cat() {
    $labels = array(
        'name'              => _x( 'FAQ Categories', 'taxonomy general name' ),
        'singular_name'     => _x( 'FAQ Category', 'taxonomy singular name' ),
        'search_items'      => __( 'Search FAQ Categories' ),
        'all_items'         => __( 'All FAQ Categories' ),
        'parent_item'       => __( 'Parent FAQ Category' ),
        'parent_item_colon' => __( 'Parent FAQ Category:' ),
        'edit_item'         => __( 'Edit FAQ Category' ), 
        'update_item'       => __( 'Update FAQ Category' ),
        'add_new_item'      => __( 'Add New FAQ Category' ),
        'new_item_name'     => __( 'New FAQ Category' ),
        'menu_name'         => __( 'FAQ Categories' ),
    );
    $args = array(
        'labels' => $labels,
        'hierarchical' => true,
    );
    register_taxonomy( 'faq_category', 'faq', $args );
}
add_action( 'init', 'my_taxonomies_faq_cat', 0 );
1
  • 1
    Thanks for the answer, I've tried your code but with the same result. However I noticed that Advanced Custom Fields is preventing the featured image to show up in the backend.
    – NielsPilon
    May 7, 2013 at 19:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.