open
15.01.2023.

How to enable post thumbnails for custom post types too?

Last update: 05.11.2024.

To enable the featured image function for a custom post type too, insert the following code snippet into the functions.php file.

This will allow you to use the featured image function for your custom post type. Just replace MYCPTNAME with the actual name of your custom post type.

 

<?php if ( function_exists( 'add_theme_support' ) ) { add_theme_support( 'post-thumbnails' );}
add_post_type_support( 'MYCPTNAME', 'thumbnail' );
?>
Copy to Clipboard

This will enable the featured image function for the MYCPTNAME custom post type too.


Related posts

Got a question? Is something not working? Write and I'll answer!

Leave a Reply

Your email address will not be published. Required fields are marked *