• There are lots of posts on the net on how to block Pinterest from everything on your site and from some images within posts, but I can’t find out how to block them from pinning images like the site logo, which show up in the Pin. It’s in the header area which is added in the customize area, and there isn’t a way to add the nopin in there.

    Does this make sense? Any suggestions?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    As you apparently know, you need to add the noPin attribute to image tags you don’t want pinned. For example:
    <img src="https://example.com/myimage.jpg" data-pin-nopin="true" />

    This is accomplished by modifying your theme templates. As every theme is different, it’s impossible to give specific advice. If you are not sure how to do this, you should ask through your theme’s dedicated support where the theme devs and expert users can help you.

    I will add that you should not directly modify theme templates. You should create a child theme and copy the relevant templates into the child. You may edit the child versions.

    If you add the noPin attribute into post content, WP may strip it out as a non-conforming attribute. To get WP to not do this, the attribute needs to be added to the allowed HTML data structure by using the “wp_kses_allowed_html” filter. Doing so requires a little custom PHP coding.

    Thread Starter 12sp

    (@sp12)

    Thank you. I will contact the theme developer.

    And that’s interesting about WP stripping out the nopin within posts. I’m guessing that newish as none of the articles out there include that information yet.

    Moderator bcworkz

    (@bcworkz)

    You’re welcome. Stripping unrecognized attributes is not new, but which attributes are allowed may have recently changed. I don’t know the status of “data-pin-nopin” specifically. I’m guessing it’s not in the allowed list by default, thus it would need to be added through the “wp_kses_allowed_html” filter if you want to use it in post content.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How do you block Pinterest for images outside the content’ is closed to new replies.