• Resolved miri

    (@miri)


    Hello. I’m attempting to add twitter cards to my site. My problem is, JetPack is adding it’s own twitter card with it’s own @jetpack tag so that the card shows up as “belonging” to jetpack instead of me. Why is jetpack adding these meta tags when I don’t have twitter sharing via Publicize turned on? (I do have sharing via Facebook on, but Facebook auto-posts to twitter for me).

    <meta name="twitter:site" content="@jetpack" />

    How can I remove the JetPack twitter card so that I can use my own? Is there a away to do so without turning off the Facebook Open Graph info?

    https://wordpress.org/plugins/jetpack/

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter miri

    (@miri)

    Ooops, never mind. I found this and it’s done the trick:
    https://wordpress.org/support/topic/how-to-change-settings-for-twitter-cards?replies=10#post-4747361

    Added this to my child theme’s function file:

    function tweakjp_custom_twitter_site( $og_tags ) {
    	$og_tags['twitter:site'] = '@mysite';
    	return $og_tags;
    }

    add_filter( ‘jetpack_open_graph_tags’, ‘tweakjp_custom_twitter_site’, 11 );

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    If you don’t want to do it through code, you can also use the option available under Settings > Sharing > Twitter Site Tag in your dashboard.

    Thread Starter miri

    (@miri)

    I changed that to enable the twitter share and hooked up my account. The tag generated by jetpack was still
    <meta name="twitter:site" content="@jetpack" />
    And not the username input.

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    That’s interesting. Are you running the latest version of Jetpack?

    Thread Starter miri

    (@miri)

    Yes.

    I did finally figure out what option you wanted me to set, but only realized that on another domain. Why? That option doesn’t appear on the original one I was asking about because I don’t have the sharing via jetpack turned on. I do have Publicize turned on (and thought you were talking about the area of publicize where I hook up the site to a twitter account). So, on sites like that, it seems the only way to turn off jetpack showing as the twitter:site owner is via the custom function. Which seems wrong to me.

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    That option doesn’t appear on the original one I was asking about because I don’t have the sharing via jetpack turned on.

    That’s correct. The option is there to change the twitter card meta tag, but also the “via @xxx” message appearing at the end of the Tweets posted via the Jetpack sharing buttons.

    So, on sites like that, it seems the only way to turn off jetpack showing as the twitter:site owner is via the custom function.

    Since you use Publicize, the twitter card value is actually automatically edited on all posts published when Publicize was active; it uses the account you linked to your site via Publicize.

    On your home page, however, we don’t have any information about your twitter account, and you do indeed need to use that function to customize the twitter card. Another alternative can be to activate a Twitter Card plugin like this one. As soon as you do so, Jetpack’s Twitter Cards are automatically removed.

    I hope this clarifies things a bit.

    Thread Starter miri

    (@miri)

    Since you use Publicize, the twitter card value is actually automatically edited on all posts published when Publicize was active; it uses the account you linked to your site via Publicize.

    And what I’ve been trying to say is: No, it doesn’t. On my development site, I have Publicize turned on. I have it linked to a twitter account. And still, on each blog post, the twitter card says:

    <meta name="twitter:site" content="@jetpack" />
    <meta name="twitter:image:src" content="my featured image url" />
    <meta name="twitter:card" content="summary_large_image" />

    When I go to the google site and do a preview of my twitter card via their tool, it shows the originator as jetpack.

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    And what I’ve been trying to say is: No, it doesn’t.

    It’s worth noting that the account will only be changed for posts you’ve published when Publicize was active, and when your twitter account was connected. It won’t work for old posts that were published before you connected your Twitter account via Publicize.

    If your Twitter account was connected to Publicize for one of you posts, you’ll notice 3 things:

    • A new custom field is created for that post, named _publicize_twitter_user, and storing your Twitter username.
    • That custom field is used to change the value of twitter:site
    • We also use the custom field to create a new Twitter met tag, twitter:creator

    If you wish to overwrite the value for old posts, and for your home page, you will indeed need to use the function, or enable the sharing module to get the option under Settings > Sharing.

    If things don’t seem to work this way for some of your posts, could you check your database and see if the _publicize_twitter_user custom field exists for these posts?

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Twitter card tag belongs to Jetpack’ is closed to new replies.