Home / Admin / Allow Tasty Pins Only On Single Posts
Duplicate Snippet

Embed Snippet on Your Site

Allow Tasty Pins Only On Single Posts

Disable Tasty Pins on pages or custom post types and only add them to blog posts.

<10
Code Preview
php
<?php
add_filter( 'the_content', function ( $content ) {
    // Return early if it is a single post.
    if ( is_singular( 'post' ) ) {
        return $content;
    }
    return str_replace( '<img ', '<img data-pin-nopin="nopin" ', $content );
} );

Comments

Add a Comment