Support » Plugin: Jetpack - WP Security, Backup, Speed, & Growth » Twitter Image Blocked

  • Resolved Andrew Arthur Dawson

    (@andrewarthurdawson)


    I am unable to get any image over to Twitter anymore. Even my own personal blog site picture, which is in every one of my blog’s, is unable to render. The following is the message I get…

    INFO: Page fetched successfully
    INFO: 24 metatags were found
    INFO: twitter:card = summary_large_image tag found
    INFO: Card loaded successfully
    WARN: The image URL https://secureservercdn.net/###################-content/uploads/2014/05/For-New-Blog2-1024×286.jpg?w=640 specified by the ‘twitter:image’ metatag may be restricted by the site’s robots.txt file, which will prevent Twitter from fetching it.

    I blocked out part of the IP address for security purposes with the #’s. But you can use any of my my recent postings on my blog and see what’s happening.

    Use the Twitter testing tool with this link for exmaple – https://thetwelfthstep.com/2021/01/12/thought-for-the-day-585/

    And you’ll get the image is blocked like all images are now blocked…by robots. I presently don’t have any issues on Facebook. There are no other plugins running other than Akismet and Relevanssi and Classic Editor, none of which deal with how metadata is handled.

    Please help.

    Sincerely,
    Andrew Arthur Dawson

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 33 total)
  • Thread Starter Andrew Arthur Dawson

    (@andrewarthurdawson)

    Ok, so I found out on the Jetpack boards a section of code that Jetpack developers put out there to help with someone else who had a similar issue. I guess the image was no longer being carried over past Jetpack 8.5 so it was allowing Twitter to get it, which in my site’s case I guess the robots were being blocked? I’m not sure I understand that, but I found this code:

    add_filter( ‘jetpack_publicize_option’, function( $option ) {
    $option[‘attach_media’] = true;
    return $option;
    } );

    I added it using Code Snippets and labeled it “Jetpack Publicize Image” and activated it. Wherever I use the main image I’ve been using in the majority of my blog postings it works. But if I change the image to anything else, it doesn’t work. Here are two examples, where the image is still being blocked:

    https://thetwelfthstep.com/2020/09/09/words-on-bathroom-walls-a-truly-stunning-masterpiece-about-schizophrenia-for-a-new-generation/

    https://thetwelfthstep.com/2020/01/15/messiah-a-riveting-netflix-series-that-asks-us-to-ponder-what-wed-all-do-if-the-messiah-supposedly-had-returned/

    Facebook renders all of my images that I attach in my blog’s just fine. It’s just Twitter.

    Hopefully someone can help shed some light on why my own personal image that I use in every one of my postings is working with this code snippet but not any other images that I attach in my blog, including other versions of that main water image. Can someone please help explain why this works in the one case but for nothing else and how to fix this for all cases?

    Sincerely,
    Andrew

    Plugin Contributor csonnek

    (@csonnek)

    Happiness Rocketeer 🚀

    @andrewarthurdawson Based on the error from Twitter’s card validator, the issue stems from their crawler bot. If they still report that specific error even after forcing our publicize code, there’s not much else we can do on our end to impact it.

    Doing a quick Google search on the error brought up this thread in the Yoast forums where the problem seems to stem from the secureserverCDN – either a setting or their own robots.txt file. That particular person was able to resolve that Twitter error by disabling the CDN.

    You can switch to using the image CDN that is built into Jetpack – that is compatible with Twitter’s crawler bot.

    Thread Starter Andrew Arthur Dawson

    (@andrewarthurdawson)

    @csonnek hi there thank you for responding. I’m not sure I understand as I have a very low understanding of WordPress hence why I use Managed WordPress on Godaddy to assist in my lack of knowledge. How do I switch to the Image CDN that is built into Jetpack? Is that a free feature and how will it work with my image that is in each of my blogs to ensure Twitter won’t block it?

    Thread Starter Andrew Arthur Dawson

    (@andrewarthurdawson)

    @csonnek I turned off CDN on GoDaddy Managed WordPress and both of those examples work now with the right image displaying. Is it ok to still leave that section of code in code snippets in…you never explained what that is actually doing when activated?

    Plugin Contributor csonnek

    (@csonnek)

    Happiness Rocketeer 🚀

    How do I switch to the Image CDN that is built into Jetpack? Is that a free feature and how will it work with my image that is in each of my blogs to ensure Twitter won’t block it?

    You would find those settings under Jetpack -> Settings -> Performance tab under the “Performance & speed” section – turn on the “speed up images” filter. This feature used to be called “Photon”, so it’s been in use for a long time and is fully compatible with Twitter’s crawler bot.

    Is it ok to still leave that section of code in code snippets in…you never explained what that is actually doing when activated?

    I assumed since you had found and implemented it that I didn’t think that you needed to know what it was for. It’s not going to hurt anything by being activated, so it’s up to you whether or not you keep it.

    Since the problem was stemming from the secureserverCDN and that it’s working for you now that it’s disabled, we’ll mark this resolved for now.

    Thread Starter Andrew Arthur Dawson

    (@andrewarthurdawson)

    @csonnek yes I’d say the problem was the CDN. I still have two questions though.

    1. If the photon thing with jetpack is turned on, does it take my image when I post and then send it to Twitter? When I used it before i thought it also slowed down my site?
    2. That code snippet I realized was to handle the Twitter image like jetpack used to. It takes my picture separately and posts on below the data for the Twitter post. I believe without that the posting is a picture that can be clicked directly as a URL?

    Plugin Contributor Dan

    (@drawmyface)

    1. If the photon thing with jetpack is turned on, does it take my image when I post and then send it to Twitter? When I used it before i thought it also slowed down my site?

    It will use your image hosted on our CDN to send to Twitter. That shouldn’t be blocked, and shouldn’t slow down your site.

    2. That code snippet I realized was to handle the Twitter image like jetpack used to. It takes my picture separately and posts on below the data for the Twitter post. I believe without that the posting is a picture that can be clicked directly as a URL?

    Right, it will add the image as an attachment instead of using a Twitter card. I’d suggest trying with and without the code and see which method you prefer.

    Thread Starter Andrew Arthur Dawson

    (@andrewarthurdawson)

    @drawmyface Ok, interesting enough, I turned off that code snippet a few days ago and also turned off the CDN on my Godaddy hosting settings page. While that issue is gone that I originally reported, what doesn’t make sense is that I still have the image being sent to Twitter on my posting separately? I have the jetpack photon thing off and have jetpack automatically post to Twitter like always and yet the image still shows up separately. But if I delete the automatic posting on Twitter that comes over and repost manually using the link from my blog posting, it posts the way I want which is with the image and link together so that it I click the picture it goes to my blog? Can someone explain why it auto posts differently from the manual post?

    Plugin Contributor Dan

    (@drawmyface)

    Hi Andrew

    I tested Publicize on a test site, and it posted the tweet exactly the same as when sharing manually, i.e. clicking the image links to the post.

    I’m not sure why that’s not happening for you. Are you sure you don’t still have any custom code active on your site that could be affecting it?

    Thread Starter Andrew Arthur Dawson

    (@andrewarthurdawson)

    @drawmyface Nope, I deactivated Code Snippets and CDN is definitely turned off. Publicize using jetpack for Twitter definitely makes the image separate now. If I delete the auto tweet and repost using the same link it invests the picture and tweet like I want. It’s almost as if that code snippet is still active but I checked and I indeed have code snippets deactivated and that snippet was turned off before I did that. It’s almost as if there’s a memory I had that snippet on at one point? I do not have any other plugins or custom code or anything that does meta data. Try this in your testing. Add that code snippet from above, auto publicize to Twitter to see if it separates the picture, if it does then good because it should and then deactivate that code snippet and then auto publicize again to Twitter and see if somehow it still thinks that snippet is active? Maybe it’s holding it on in memory?

    Plugin Contributor Dan

    (@drawmyface)

    Hi @andrewarthurdawson

    Ok, yes, that snippet changes the option in your database, so removing the snippet will still leave that option set to true. What you’ll need to do is add a new snippet to set the option back to false:

    add_filter( 'jetpack_publicize_options', function( $option ) {
    $option['attach_media'] = false;
    return $option;
    } );

    Once you’ve run that on the site you can remove it as the option will remain set to false.

    Hope that helps!

    By the way, I noticed in your comment here, you mentioned the filter as jetpack_publicize_option. That should be jetpack_publicize_options but I assume you got it right on your site otherwise it wouldn’t have worked.

    Thread Starter Andrew Arthur Dawson

    (@andrewarthurdawson)

    @drawmyface That is indeed interesting. I thought a snippet only works so long as its set to on and once off its temporary use becomes off? Isn’t that the point of snippets? And once I set this on and run it. Can I turn it back off or do I need to leave snippets active?

    Thread Starter Andrew Arthur Dawson

    (@andrewarthurdawson)

    @drawmyface Ok, so I placed your code in. This is what is showing in my code snippets right now:

    add_filter( ‘jetpack_publicize_options’, function( $option ) {
    $option[‘attach_media’] = false;
    return $option;
    } );

    It’s active and I have it set to “run snippet everywhere” like I did the first time when the function was set to true. Sadly, this still didn’t turn off the way it’s posting the picture. It’s still seperating the picture when it comes over from the Jetpack publicize. But as soon as I delete it and place the link in Twitter to share, it does it correctly. I don’t know what to do now? Why can’t I turn this off? Does it have to do with me having it set to “run snippet everywhere”? The only other snippet I had in my snippet list is one Jeremy Herve had me do ages ago but I deactivated but never deleted. It’s the following:

    function custom_jetpack_default_image() {
    return ‘http://thetwelfthstep.com/wp-content/uploads/2014/05/For-New-Blog4-1024×315.jpg’;
    }
    add_filter( ‘jetpack_open_graph_image_default’, ‘custom_jetpack_default_image’ );

    It’s been turned off for years so I can’t imagine that’s impacting it? Regardless I just deleted it so it’s not even in snippets, but I don’t think anything has t one invalidated for it because I’ve been running auto posting from Jetpack fine for a long time. So I have no idea, I used your code, ran it with the everywhere option running, and then posted tonight automatically to twitter and it continues to show up with the picture separate until I delete and repost the link. I hope you can make some sense in this and help me to get this working without having to keep deleting my auto Tweet and manually doing it to make it show up the way it used to.

    Plugin Contributor Dan

    (@drawmyface)

    I thought a snippet only works so long as its set to on and once off its temporary use becomes off? Isn’t that the point of snippets? And once I set this on and run it. Can I turn it back off or do I need to leave snippets active?

    It depends what the snippet does. Some snippets only affect the site while they are running at the time of loading a page, so if you turn them off, the site will behave as it did before you ran the snippet.

    Others (like this one) change values in the database, which is a change that is permanent (unless you run another snippet to change the value again).

    It’s still seperating the picture when it comes over from the Jetpack publicize.

    I wonder if there’s an error in your snippet. Can you check that your snippet contains proper quotes? They should be ” rather than ‘’ – did you copy and paste the snippet from my previous reply?

    Aside from that, “run snippet everywhere” is correct, and that other snippet should have no effect, so if it’s still not working, I’m not sure what the issue is. Can you log into MySQL via your host and check the value of the ‘jetpack_publicize_options’ option in the wp_options table of your database?

    Thread Starter Andrew Arthur Dawson

    (@andrewarthurdawson)

    @drawmyface The code snippet I put in my last reply is the exact code that I ran and then deactivated after running. Are the quotes correct in what I cut and pasted into here? If so, I use FillaZilla and just want to make absolutely sure where this option is to check? When I log in to FileZilla and am looking at the root, where exactly do I navigate to, to see this file and double click it to look at it?

Viewing 15 replies - 1 through 15 (of 33 total)
  • You must be logged in to reply to this topic.