Envira Gallery Documentation

Documentation, Reference Materials and Tutorials for Envira Gallery

Disable Pinterest Pin It Button (Browser Extension)

To disable Pinterest’s browser extension from showing the “Pin It” button on your Envira Gallery images:

  1. Add the following code to a new file at wp-content/plugins/envira-gallery-disable-pinterest-button.php:
  2. <?php
    /**
    * Plugin Name: Envira - Disable Pinterest Button on Image Hover
    * Plugin URI: https://enviragallery.com
    * Version: 1.0
    * Author: Envira Gallery Team
    * Author URI: https://enviragallery.com
    * Description: Adds nopin="nopin" to Envira Gallery Images, disabling the Pinterest Button when hovering over an image.
    */
    /**
     * Adds nopin="nopin" to Envira Gallery Images, disabling the Pinterest Button when hovering over an image.
     *
     * @param string 	$atts 	<img> tag attributes
     * @param int 		$id 	Image ID
     * @param array 	$item 	Image Data
     * @param array 	$data 	Gallery Config
     * @param int 		$i 		Index
     * @return string 			Image Attributes
     */ 
    function envira_disable_pinterest_button( $atts, $id, $item, $data, $i ) {
    	return $atts . ' nopin="nopin"';
    }
    add_filter( 'envira_gallery_output_image_attr', 'envira_disable_pinterest_button', 10, 5 );
    
  3. Navigate to the WordPress admin » Plugins and activate the Envira – Disable Pinterest Button on Image Hover plugin.