Jetpack’s Publicize Now Uses Twitter Cards

A long time ago, Jetpack’s Publicize feature—which automatically posts to your social media platforms when you publish a new post—started attaching an image to your tweets to help them catch people’s attention.

At the time, a tweet with a picture would perform better than a tweet with just a link.

This is all fine and good, but a lot has changed since Jetpack started doing that. Twitter cards, if nothing else, not only were developed but were opened up to all (remember when you used to have to opt-in?). When you attach media, that’s the “special” part of your tweet. The Twitter Card, rendered from the meta tags on your post, is not displayed.

Today, effective for all versions of Jetpack and all sites, Publicize will no longer attach a picture to your tweet, instead allowing Twitter to display the Twitter card it renders.

If you want to return to the old way and are on Jetpack 8.5 (released today) or Business, you can add a small code snippet to change it.

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

This filter will, in the end, notify’s server of your preference and use it for future Publicize posts.

Questions about Jetpack’s Publicize feature? There is a team of Happiness Engineers ready to help!

By Brandon Kraft

My life is an open-source book.

19 replies on “Jetpack’s Publicize Now Uses Twitter Cards

Thanks for pointing that out! There was a typo in the snippet. jetpack_publicize_option should have been jetpack_publicize_options.

The post has been updated. Thanks for pointing it out!

Hey, I’m just throwing this out there – I threw this PHP in and I’m getting an error (I amended the typo) – Publicize is still just resolving an image itself.

Weirdly, I did reply this morning but it didn’t post, and now it’s no longer on my clipboard…I’ll trynand find it again but it did moan about functions.php.

hey Brandon, right, here’s the output/error : Warning: count(): Parameter must be an array or an object that implements Countable in /home/*****/public_html/wp-includes/post-template.php on line 317

Warning: Cannot modify header information – headers already sent by (output started at /home/*****/public_html/wp-includes/post-template.php:317) in /home/*****/public_html/wp-admin/post.php on line 231

Hi Craig, in and of itself, I don’t see how it’s related to the change Jetpack made nor the code snippet above.

My guess is a plugin or theme is needing an update to be more compatible with newer versions of PHP.

Hi Jake,

You have a few options. You can use something like a Code Snippets plugin or a Core Functionality plugin of your own making.

The key is you definitely don’t want to add it to an existing plugin that you’ve installed on your site from the WordPress plugin directory or a theme, particular one that has updates possible (like any from the WordPress directory). In both of those cases, the snippet would be lost when the plugin/theme is updated.



Leave a Reply

Your email address will not be published. Required fields are marked *