0

I'm creating an Wordpress plugin where I'll have a fully customized custom post form. How can I add "Featured Image" box in my form?

For example, wp_editor() function shows TinyMCE editor. Is there any function to show featured image box?

enter image description here

Thanks in advance.

1

You can add that featured image metabox you've circled to your custom post type by doing:

register_post_type( 'yourCPTslug', [
    //...
    'supports' => ['title', 'editor', 'thumbnail'] // note: thumbnail
] );


add_action( 'after_setup_theme', function () {
    add_theme_support( 'post-thumbnails' , ['yourCPTslug'] );
});

As for a single function calling it in a position where you want it - I'm fairly certain no.

Your Answer

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

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