Twitter’s New Official WordPress Plugin Prioritizes Extensibility

twitter

It’s easy to get overwhelmed when visiting the WordPress.org plugin directory in search of a Twitter plugin, as you’ll turn up more than 3,000 Twitter-related extensions. Unless you’re running on recommendations or personal experience, it may not be easy to narrow down a quality plugin that keeps pace with changes to the Twitter API.

This week Twitter finally decided to release an official WordPress plugin to assist users in optimizing their sites for a Twitter audience. I spoke with Niall Kennedy, Developer Advocate at Twitter and contributor on its official WordPress plugin, about Twitter’s plans for the plugin. Kennedy is also listed as a contributor on both the official Facebook and Vine plugins for WordPress.

“Twitter regularly works with partners to implement Twitter features on their site,” Kennedy said. “Shipping an official plugin allows us to directly support publishers powered by WordPress and provide an example implementation of Twitter best practices for publishers on any platform.”

The plugin requires PHP 5.4 or later and offers many features that you many have already seen available via other extensions, including customization of embedded tweets, embedded Twitter videos, Tweet button for sharing content, Twitter Cards, integration with Twitter Analytics, a Follow button, and ads conversion tracking.

Many are wondering why anyone needs an official Twitter plugin, given that WordPress already has excellent oEmbed support for tweets. Kennedy confirmed that the new plugin plays nicely with the built-in oEmbed support, while building on top of it:

The Twitter plugin for WordPress enhances the oEmbed support built-in to WordPress with additional customization and functionality. We enhance the typical oEmbed response with additional integrations with WordPress APIs.

Our plugin loads Twitter’s widgets JavaScript asynchronously through wp_enqueue_script, omitting the script element typically inserted onto the page markup through the default oEmbed response.

Each embedded Tweet, added through a URL or shortcode, passes through the shortcode’s filter (shortcode_atts_tweet) for customization of embedded Tweet features across the site. The plugin handles fetching the correct oEmbed markup from Twitter’s servers and caching the unique result for the customization.

The plugin does not change MCE oEmbed handling in the admin view.

Kennedy declined to comment on why it took Twitter so long to release an official plugin, but hopes that WordPress developers will use it as a building block. Those who previously created Twitter plugins now have a solid example for how best to extend WordPress to customize Twitter’s latest features.

Designed to be Extensibile

The development team behind the plugin plans to add new features to it as they become available from Twitter. They recognize that it will not be realistic to offer every imaginable feature, but instead are prioritizing extensibility to make sure developers can easily create their own customizations.

“The plugin includes support for displaying Twitter-hosted video embeds, a new feature available to Twitter developers just in the past few weeks,” Kennedy said. “An official Twitter plugin makes it easy to roll out new features to publishers.

We’re working with other plugin developers to integrate features through filters where any overlap may occur,” he said. Kennedy has a few ideas for the kinds of integrations that developers might want to build for the plugin using the WordPress APIs.

“Our plugin automatically generates Twitter Card markup to represent a post, making some best guesses for post formats built-in to Core,” he said. “We expect plugin developers creating more specific display experiences will be able to build on top of our base features to select the best Twitter Cards template for their content.”

Kennedy also believes the plugin can be further extended by SEO plugins to optimize content. “Some of the most popular WordPress plugins involve SEO,” he said. “We would like to integrate with SEO plugins to highlight the best titles, descriptions, and other detailed data provided by publishers to help their content stand out on Twitter.”

Additionally, he sees an opportunity for theme developers to make tweets a seamless part of a theme’s overall design. “Our embedded Tweet theming can be customized by theme authors to match the visual theme of their site,” Kennedy said. “Automatically adjusting Twitter theming components to a WordPress theme context would be pretty cool.”

If you’re looking to add the most common Twitter features to your WordPress site, you’ll be hard pressed to find a better plugin than the official one on WordPress.org. Kennedy confirmed that Twitter plans to support the plugin through its official support forums on WordPress.org and will also have an escalated support channel for managed hosting providers.

Would you like to write for WP Tavern? We are always accepting guest posts from the community and are looking for new contributors. Get in touch with us and let's discuss your ideas.

11 Comments


  1. Do I still need this plugin after having Jetpack?
    Official tweets widget and all that stuff?.
    This plugin is official, yes, but is it needed or important right now?, won’t it have clashes with Yoast seo? (twitter cards)

    Report


    1. It depends on if you want to do more than just push your content to Twitter. If that’s all you need, then Jetpack is fine. But if you want to do more and use Twitter’s advertising network, then their official plugin is the one to use. As for Yoast SEO and Twitter cards, I have no idea. We should ask him :)

      Report


      1. The twitter cards stuff, is pretty much a big deal. And by the way, I downloaded the plugin, I didnt see it function in any way. No settings, or widgets or cool stuff.

        Report


  2. “It’s easy to get overwhelmed when visiting the WordPress.org plugin directory in search of a Twitter plugin, as you’ll turn up more than 3,000 Twitter-related extensions”

    I think only a small fraction of these plugins are actually Twitter-related. The others just turn up in a search, because the author somewhere mentions their Twitter handle in the plugin meta.

    Report


    1. Still super confusing to the average Joe looking for a common set of features that he can rely on to be regularly maintained.

      Report


  3. I like the idea of pushing for using current/modern PHP versions, however the fact that the plugin doesn’t work for versions below 5.4 seems like kind of a fault to me. Curious why that choice was made, if it was intentional.

    Report


    1. Agree with you ! They could have write some code to deactivate the plugin (easy to set) if PHP version is not compatible. What’s the point : let a plugin run while it’s not working. But I kinda like the idea of PHP 5.4 requirement.

      Report


  4. how about a twitch embed that doesnt require knowing code? theres already a dozen like it….

    Report


    1. Until Twitch decides to properly support oembed, that is unlikely to make it into core. Even the current plugins use embed.ly to deal with it.

      The problem is on Twitch, basically. When they learn how to do normal embeds, then there’s a good chance of them being whitelisted.

      Report


  5. I’d rather use a Twitter plugin created by Twitter for WP than try any of those random plugins. Just seems Twitter would have the most interest in getting it right and keeping it updated. I can only hope they keep it clean versus spamminess. I’ve been having a lot more trouble with plugins that way lately.

    Report

Comments are closed.