Featured Image Missing From Admin Sidebar – Add To Theme Function
Featured Image Missing From Admin Sidebar – Add To Theme Function
Very quick code snippet for you today yet extremely important. I was talking to a younger developer the other day who is trying to get a better grasp on WordPress. To do so, they were developing a custom theme for a client. They had spent the last hour almost smashing their head through a wall trying to figure out why the standard ‘featured image’ field was missing while creating a new post.
I walked over to discuss and had a pretty good idea of what the issue was, they had not yet added it via the add_theme_support function but since this was a learning environment I asked if they had searched through the Codex for a solution. They had, and we did together, and surprisingly this function is rather hard to find through common search terms so I thought I would add it in here:
add_theme_support( 'post-thumbnails', array( 'post', 'page' ) );
Yep, that’s it. You can obviously add it to additional post types as well by adding the post type name within the array. Don’t smash your head into a wall, the answer is out there, and it’s probably easier than you think.
Share Your Thoughts