How to Add Thumbnail Support to the WordPress Theme

4.5 from 5
from 2 user
(Rate this post)
How to Add Thumbnail Support to the WordPress Theme

If you do not see the set featured image box beside the post editor in the WordPress admin panel to set the featured image of posts, your solution is here. Just copy/paste this code snippet to the function.php file of your theme.

Code to Fix the No Thumbnail Support Problem

There is a common problem for beginner developers when developing a new theme for WordPress.
You need to register some features for your theme to use them in your theme. One of them is post thumbnail support which can be added using the below code in the function.php file:

function my_theme_register_post_thumnails(){
    add_theme_support( 'post-thumbnails' );
}
add_action( 'after_setup_theme', 'my_theme_register_post_thumnails' );

After copying the above code to the functions.php file of your custom theme, you can visit the post editor to see the Set featured image box in the sidebar under the Featured image headline.

Why did this problem happen?

Not all WordPress features are usable directly in custom themes. You may need to register some features for themes to use them.

Here is the list of features you must register before using them in your custom theme:

  • admin-bar
  • align-wide
  • automatic-feed-links
  • core-block-patterns
  • custom-background
  • custom-header
  • custom-line-height
  • custom-logo
  • customize-selective-refresh-widgets
  • custom-spacing
  • custom-units
  • dark-editor-style
  • disable-custom-colors
  • disable-custom-font-sizes
  • editor-color-palette
  • editor-gradient-presets
  • editor-font-sizes
  • editor-styles
  • featured-content
  • html5
  • menus
  • post-formats
  • post-thumbnails
  • responsive-embeds
  • starter-content
  • title-tag
  • wp-block-styles
  • widgets
  • widgets-block-editor

What do you think about "How to Add Thumbnail Support to the WordPress Theme"?

Your rating submit was successfull.

Your rating submit was not successfull.

Menu