Created
November 20, 2012 03:54
-
-
Save takien/4115858 to your computer and use it in GitHub Desktop.
WordPress, Disable Featured image on Single Post
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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