Disable Featured Images in Twenty Nineteen Theme without CSS

Today I decided to use a brand new Twenty Nineteen theme on one of my WordPress websites. Theme is awesome but I didn’t like how featured images are displayed, especially on single post pages.

Of course everything is possible to hide with CSS ? But it isn’t a solution, is it?

The solution is as simple as a single line of code:

/**
 * @snippet       Disable Featured Images in Twenty Nineteen WordPress theme
 * @sourcecode    https://rudrastyh.com/?p=8383
 * @author        Misha Rudrastyh
 */
add_filter('twentynineteen_can_show_post_thumbnail', '__return_false');

This code will hide featured images in:

Where to insert this code? You can create a custom plugin and paste that line of code in it or you can use it in functions.php file of a child theme (I used this way).

Seems too difficult? Download my plugin.

Of course functions.php inside Twenty Nineteen theme itself is not recommended, it will work only until the first theme update.

Maybe it is Better to Remove Featured Images from Every Post?

Yep, it is an option too! But what to do if you have hundreds of posts?

Easy-peasy! All you have to do is to run this SQL query in your database phpMyAdmin:

DELETE FROM wp_postmeta WHERE meta_key = '_thumbnail_id';

Should I remind you that you have to always backup your database before running any queries in it? And do not forget to replace the wp_ if you’re using a custom database prefix.

Related Posts

Misha Rudrastyh

Misha Rudrastyh

I love WordPress, WooCommerce and Gutenberg so much. 10 yrs of experience.

Need some custom developer help? Let me know

Follow Misha

Need some help with WordPress?

If you need some professional developer help, I will be happy to assist you.

Contact me Who I am?

Leave a comment

php js HTML CSS Code