Prevent images from being pinned to Pinterest.com

Content Views helps you to show thumbnail image of posts easily.
If you are installing another plugin which adds the “pin” button of Pinterest to images, but want to disable that button for images in View, please add this code to file functions.php in the theme’s folder (or install this plugin Code Snippets then add this code to the “Code” textarea):

// Content Views Pro - Prevent images from being pinned to Pinterest
add_filter( 'pt_cv_field_thumbnail_image_html', 'cvp_theme_field_thumbnail_image_html', 100, 1 );
function cvp_theme_field_thumbnail_image_html( $args ) {
	global $pt_cv_id;
	if ( $pt_cv_id === 'VIEW_ID' ) {
		$args = str_replace('<img', '<img nopin = "nopin" data-pin-nopin="true"', $args);
	}

	return $args;
}

(replace VIEW_ID with ID of your View)

Best regards,

Scroll to Top