Skip to content

Instantly share code, notes, and snippets.

@takien
Created November 20, 2012 03:54
Show Gist options
  • Save takien/4115858 to your computer and use it in GitHub Desktop.
Save takien/4115858 to your computer and use it in GitHub Desktop.
WordPress, Disable Featured image on Single Post
/**
* Disable Featured image on Single Post
* @version: 1.0
* @author: takien
* @url: http://takien.com
* Copy and paste this code in your theme's functions.php
*/
add_filter('post_thumbnail_html','disable_single_featured');
function disable_single_featured(){
if(is_single()){
return false;
}
}
/*
* if code above not work, try this one
* please use one of them, not both.
*/
add_filter('get_post_metadata', 'disable_single_featured', true, 4);
function disable_single_featured($metadata, $object_id, $meta_key, $single){
if(is_single() AND isset($meta_key) AND ($meta_key == '_thumbnail_id')){
return false;
}
else {
return $metadata;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment