How to Control Which Images Appear in the Pinterest Share Picker
Content
One of the most common questions about the 'AddToAny Share Buttons' plugin is how to control the images that appear when a visitor clicks the Pinterest share button. By default, Pinterest's built-in image picker scans the entire page, often including logos, sidebar images, and other graphics you might not want to be pinnable. This can create a cluttered and overwhelming experience for users.
This guide explains why this happens and provides the most effective methods for taking control of your pinnable images.
Why This Happens
The Pinterest share button loads Pinterest's own official script and image picker. This picker operates independently and scans the entire HTML of your page for images. It is not directly controlled by the 'AddToAny Share Buttons' plugin. Therefore, to influence which images are shown, you need to use methods that Pinterest itself provides or use alternative sharing methods offered by AddToAny.
Common Solutions
1. Exclude Unwanted Images with data-pin-nopin
The most direct method is to add a data-pin-nopin="true" attribute to the HTML <img> tags for any images you want to exclude from the Pinterest picker. This is a standard method provided by Pinterest.
Example:
<img src="https://example.com/logo.png" data-pin-nopin="true">
You may need to modify your theme's template files or use a plugin that allows you to add custom attributes to images to implement this across your site.
2. Use AddToAny Image Sharing for Individual Images
Instead of using the standard share bar button, you can enable image sharing. This places a Pinterest button that appears on hover over specific images you choose. This method shares that specific image directly, bypassing Pinterest's image picker entirely.
To enable this, add the following JavaScript code to the Settings > AddToAny > Additional JavaScript box:
a2a_config.overlays.push({
services: ['pinterest'],
size: '50', // Adjust the size as needed
target: 'img.wp-post-image' // Use a CSS selector to target your desired images
});
You can customize the target property with a more specific CSS selector (e.g., #content img, .post-image) to control exactly which images get the hover button.
3. Force the Share Button to Use a Specific Image
You can use AddToAny's event callbacks to override the default behavior of the standard share button and force it to share a specific image, such as the post's featured image. This also avoids the image picker.
The following code example will make the standard Pinterest button in your share bar share the first image found within your post's <article> tag.
a2a_config.callbacks.push({
share: function(data) {
// Get the first image in the post if present on the page
var image = document.querySelector('body.single article img');
// If sharing to Pinterest and the image was found
if ('Pinterest' === data.service && image && image.src) {
// Set the shared media to the found image
return {
media: image.src
};
}
}
});
Add this code to the Additional JavaScript box as well. You may need to adjust the body.single article img selector to match your theme's structure.
Important Considerations
- Pinterest's Limitations: It is not possible to make Pinterest's native image picker open in a new window or to curate a custom list of only a “select few” images within it. The methods above work by avoiding the picker altogether.
- Combining Methods: Many users successfully combine these methods. For example, they use the
data-pin-nopinattribute to hide unwanted images from the picker and also implement image hover buttons for key images. - Testing: Always clear your cache and test these changes thoroughly on your live site to ensure they work as expected.
By using these techniques, you can significantly improve the Pinterest sharing experience on your website, guiding users to pin the images you want them to share.
Related Support Threads Support
-
Can I limit the Pin images?https://wordpress.org/support/topic/can-i-limit-the-pin-images/
-
How to set a select few images for Pinterest sharinghttps://wordpress.org/support/topic/how-to-set-a-select-few-images-for-pinterest-sharing/
-
default pinterest imagehttps://wordpress.org/support/topic/default-pinterest-image/
-
Pin-it Button on AMP Imageshttps://wordpress.org/support/topic/pin-it-button-on-amp-images/
-
Giving One photo as an option for Pinterest Pinhttps://wordpress.org/support/topic/giving-one-photo-as-an-option-for-pinterest-pin/
-
Pinterest – Sharing featured image on regular button and specific image on hoverhttps://wordpress.org/support/topic/pinterest-sharing-featured-image-on-regular-button-and-specific-image-on-hover/
-
Can Pinterest Image Picker share two images only?https://wordpress.org/support/topic/can-pinterest-image-picker-share-two-images-only/
-
Pull custom description for social media sharinghttps://wordpress.org/support/topic/pull-custom-description-for-social-media-sharing/
-
Pasted pinterest total shares and pin not showing after pastinghttps://wordpress.org/support/topic/pasted-pinterest-total-shares-and-pin-not-showing-after-pasting/
-
How to enable rich pinshttps://wordpress.org/support/topic/how-to-enable-rich-pins/
-
Issue with Pinterest sharinghttps://wordpress.org/support/topic/issue-with-pinterest-sharing/
-
Pinterest Share using Alt Text, not Data-Pin-Descriptionhttps://wordpress.org/support/topic/pinterest-share-using-alt-text-not-data-pin-description/
-
Use Image Title Instead of Alt for Pinterest Descriptionhttps://wordpress.org/support/topic/use-image-title-instead-of-alt-for-pinterest-description/
-
Disable Pinning on Certain Images?https://wordpress.org/support/topic/disable-pinning-on-certain-images/
-
Testing this Plugin for Pinterest sharinghttps://wordpress.org/support/topic/testing-this-plugin-for-pinterest-sharing/
-
Select Pinterest specific image or minimum image sizehttps://wordpress.org/support/topic/select-pinterest-specific-image-or-minimum-image-size/