0

I am working in a plugin and in that plugin adding wordpress default editor(wp_editor)and adding functionality to save post with add media features.

Add media features is working absolutely fine and adding media to respective post, but i want to add image as a thumbnail but i am not able to add set featured image button to the add media button.

This is the code i am writing to add WordPress default editor:

wp_editor( $post_content , 'productinfoeditor', array(
'media_uploads'=>true,
'textarea_name' => 'product_info_content', 
'editor_class' => 'requiredField', 
'teeny' => true, 
'textarea_rows' => 14
) );

In function.php file

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

And saving post with:

$post = array();
$post['post_type'] = 'product';
$post['post_content'] = $product_info_content;
$post['post_author'] = $user_ID;
$post['post_status'] = 'publish';
$post['post_title'] = $product_title;
$post_id = wp_insert_post( $post );
0

1 Answer 1

1

Your product post type should have support for thumbnail. See the codex for more info on supports.

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.