1. Home
  2. Knowledge Base
  3. Tasty Pins
  4. Troubleshooting Tasty Pins
  5. How do I disable pinning on my theme’s featured images?

How do I disable pinning on my theme’s featured images?

Featured images are a theme-specific development. While you can set Tasty Pin settings for the images that are used as featured images, Tasty Pins does not have any control over how featured images are being displayed. However, due to the common request, we've written the below filter, which you can add it to your theme functions.php file:

 * Disable pinning of all featured images.
add_filter( 'post_thumbnail_html', function( $html ){
// Something already has 'data-pin-nopin', so we don't need to modify.
if ( false !== stripos( $html, 'data-pin-nopin' ) ) {
return $html;
// Add 'data-pin-nopin' to the <img> HTML tag.
$html = str_replace( '<img ', '<img data-pin-nopin="true" ', $html );
return $html;

The way featured images are added to the theme depends on how the theme author built the theme, so this will only work if they used the WordPress-provided function for adding featured images. 

If they went about it in a different way then this likely won't work. In that case, you will need to contact the theme developer and request that they add the data-pin-nopin=”true” attribute to those images.

Was this article helpful?

Related Articles

Need Support?

Can't find the answer you're looking for?
Contact Support