Plugin Directory

Tweet This

Popular Twitter plugin inserts "Tweet This" links so your readers can share posts with one click. Automatically tweets new posts via OAuth.

Download Version 1.8.3

What are the minimum requirements for Tweet This?

WordPress 2.7, PHP 5.0.0, and Curl. Read the Installation section for details.

How do I make Tweet This show on posts, but NOT on pages?

Go to Settings > Tweet This, click "Advanced Options," check "Hide Tweet This block on pages," and click "Save Options."

How do I hide Tweet This on RSS feeds?

Go to Settings > Tweet This, click "Advanced Options," check "Hide Tweet This block on all feeds," and click "Save Options."

How do I position the Tweet This links before posts?

Go to Settings > Tweet This, click "Advanced Options," check "Insert Tweet This block before content," uncheck "Insert Tweet This block after content" (unless you want the links appearing in both places), and click "Save Options."

Does Tweet This provide a widget of my latest tweets?

Yes, on WordPress 2.8 or later a Twitter Updates widget is available, which functions like the Wickett Twitter Widget plugin by Automattic Inc.

How does OAuth automatic tweeting work?

Register for Twitter OAuth and enter your application keys in Settings > Tweet This > Automatic Tweeting. There are also instructions there. Then, look for the box titled Tweet This on the Write Post screen and check "Send to Twitter." If you want this enabled by default, check "'Send to Twitter' defaults to checked on unpublished posts" in Settings > Tweet This > Automatic Tweeting.

Why is automatic tweeting not working?

Make sure you have entered your OAuth keys correctly. Click "Test Twitter OAuth" in Settings > Tweet This > Automatic Tweeting to verify. On your Twitter application settings, "Default Access type" must be set to "Read & Write." Also, make sure you have checked "Send to Twitter" on the Write Post screen.

How does the "Write Tweet" page work?

After you enter your OAuth keys, a new submenu titled "Write Tweet" will appear under the Pages menu. From this page, you can not only write tweets, but schedule future tweets to a MySQL table wp_tweet_this_scheduled. URLs entered here are automatically shortened if the tweet text exceeds 140 characters. A preview function is included, and you can see a list of up to 100 of your latest scheduled tweets.

How do scheduled tweets work?

The schedule tweet function on the Write Tweet page adds a row to the

wp_tweet_this_scheduled

MySQL table with the scheduled date, the tweet text, and the status set to "future". When the first tweet is scheduled, an option is added to the wp_options table titled tweet_this_last_cron with the value of (time() - 86400). On every page load, (time() - 600) is compared to this option; if it is greater, it has been more than ten minutes since the last scheduled tweets were processed, so tweet_this_init attempts to publish all the tweets with a status of "future" and a scheduled date in the past. If this succeeds, the tweet's status is set to "publish"; if it fails, it is set to "fail". Scheduled tweeting requires that someone actually visits your blog after the scheduled date. The scheduled tweet is not triggered until a page is loaded. Automatic tweets on scheduled posts are much simpler: the function to publish the tweet is simply attached to the publish_post hook.

What's the difference between Web Links and Share Links?

Web links are what Tweet This has always used. They take the form http://twitter.com/intent/tweet?text=Your+message and will display "via web" when tweeted. Share links are like http://bit.ly/asEAtj (long URL) and use the same API as the official Tweet button, but as a regular link instead of a JavaScript popup. They use Twitter's official URL shortener, T.co, allow you to specify up to two related users to be suggested after the tweet is made, and will display "via Tweet Button" when tweeted.

How does the cache work?

Cached short URLs are saved to the postmeta table when a visitor views posts. For any future pageloads, those URLs are loaded, instead of contacting Bit.ly or TinyURL again. As long as the post's permalink doesn't change, the short URL from the third-party service doesn't change.

The cache is invalidated by setting the existing short URLs in the postmeta table to "getnew" as needed. By reusing the old fields instead of replacing them, I don't bump up the meta_id counter needlessly. When the next person visits that post, the get_tweet_this_short_url function in Tweet This sees this and gets a new short URL.

What triggers a cached URL as invalid? When you save a post (including editing and publishing), the cache is invalidated in case you changed the permalink. Secondly, when you change URL services under Settings > Tweet This or change permalink structures under Options > Permalinks, all the cached URLs are set to "getnew". Finally, if you change "Use 'www.' instead of 'http://' in shortened URLs" or "Don't shorten URLs under 30 characters," or import new settings, the cache is invalidated. If you move your blog to a different directory or domain name, click the "Flush URL Cache" button in the options.

When you deactivate the plugin, all the cached URLs are deleted.

How does importing and exporting options work?

In the options menu, there is a section titled "Import / Export Options." This is as simple as can be: the export is a raw dump of the tweet_this_settings row from the wp_options table, and to import, you just paste that dump in the import text area. Click "Import Options," and your current options will be replaced. Your OAuth keys are included, so don't share it with anyone.

How does setting a custom short URL service work?

You enter the API's path with [LONGURL] as the long URL. For TinyURL, for example, you would enter "http://tinyurl.com/api-create.php?url=[LONGURL]". Then Tweet This uses that service for all its short URLs. The API must accept HTTP GET requests (not POST), and it must output a plain-text short URL (no HTML, XML, or arrays) with the http prefix.

How does the editable Tweet This text box work?

One of the options for the Twitter icon in the Tweet This Options is "Editable text box." This gives your readers a text box with character counter so they can change the tweet on your site before going to Twitter. When you click the submit button, an interstitial is loaded which parses and sends the new tweet text, forwarding the reader to Twitter. Then it is the same as the regular options: the reader can edit the tweet further on Twitter, or submit.

How does the tt-config.php file work?

Tweet This ships with the file named as tt-config-sample.php. This way, if you rename it to tt-config.php to use it, you can still upload future versions of Tweet This right over the old directory, because your customized tt-config.php file will not be overwritten. Once you rename it, there are several options you can set in it that are too advanced or cannot be included in the regular options menu. Note that you WordPress automatic upgrade will always delete tt-config.php.

Can I use the Tweet This functions in my theme?

Yes. Within the loop, these functions are available:

tweet_this_manual() : Echoes all the Tweet This links and disables regular
output. Useful for moving the Tweet This links above each post. If you want to
insert Tweet This below where it is normally inserted, you must add the line
"remove_filter('the_content', 'insert_tweet_this');" before this function.

tweet_this($service, $tweet_text, $link_text, $title_text, $icon_file,
$a_class, $img_class, $img_alt) : Echoes a Tweet This link. This is only
useful if you disable automatic insertion in the settings.  You can leave
the parameters blank like '' to use your settings from the options page.
$services can be 'twitter', 'plurk', 'buzz', etc. The $icon_file parameter is
for the filename of an image from the /tweet-this/icons/ folder. Sample usage:
tweet_this('twitter', '@richardxthripp [TITLE] [URL]', '[BLANK]',
'Share on Twitter [[URL]]', 'de/tt-twitter-big3-de.png', 'tweet-this',
'tt-image', 'Post to Twitter'). $icon_file can also be set to "noicon".

tweet_this_url($tweet_text, $service) : Echoes the Tweet This URL.
Optional tweet_text parameter overrides "Tweet Text" from the
options menu. $service can be 'twitter' or 'plurk', or omitted for Twitter.
Sample usage: tweet_this_url('@richardxthripp [TITLE] [URL]', 'twitter').

tt_shortlink() : Just echoes the short URL for the post (Local, Bit.ly,
TinyURL, etc.), cached if possible. Creates the short URL on-the-fly if needed.

tt_option($key) : like get_option(), but specifically for Tweet This
settings. Useful for retrieving settings from the database.
Sample usage: tt_option('tt_url_service'). Returns without echoing.

You can prefix these functions with get_ to return the data without echoing, for further manipulation by PHP.

How much memory does Tweet This use?

Tweet This is nearly 5000 lines of PHP and stores over 120 options in a serialized array in the wp_options table. A typical Tweet This installation uses about 1MB of RAM per WordPress instance. Even if you are not using Tweet Tweet, you should use a caching plugin such as W3 Total Cache because WordPress is a resource hog.

Can I disable Tweet This on a specific post or page?

Yes: add a custom field titled tweet_this_hide with the value of "true".

Can I just use the Tweet This functions without it adding icons to my blog?

Sure! Activate the plugin, go to Settings > Tweet This, uncheck "Insert Tweet This," and click "Save Options."

If I change URL services, will the old URLs continue to work?

Yes. The short URLs are on third-party servers (Bit.ly, Su.pr, TinyURL, etc.), and they should never delete them. Local URLs are built into WordPress and will continue to work.

Does Tweet This let me write new tweets from my dashboard?

Yes: from the "Write Tweet" page under the "Pages" menu.

Can Tweet This support many authors and their Twitter accounts on one blog?

No. Automatic tweeting only works with one account per blog.

Can I use variables such as [AUTHOR], [CATEGORY], [DATE], and [TIME]?

Yes: a complete list is displayed in the options below the Twitter icons.

Can I set Tweet This to fetch short URLs on demand, instead of in advance?

No, but you can use Share Links which use Twitter's official URL shortener.

Does Tweet This provide click stats?

No, but you can use Bit.ly and enter your API key to get stats from Bit.ly.

Can I change the order of the extended services?

Yes: at the bottom of the Extended Services section in the options, there is a comma delimited field titled "Public Display Order" to do just that.

Can I use short URLs from an external plugin such as YOURLS or Pretty Link?

No.

Can I change the tweet text on a post-by-post basis?

No.

Can I use full-length URLs instead of URLs that end with "/?p=1234"?

Yes: in the Advanced Options section in the options, check the box titled "Use full permalinks unless Tweet/Plurk Text exceeds 140 characters."

Requires: 2.7 or higher
Compatible up to: 3.2.1
Last Updated: 2010-11-6 Downloads: 230,634

Average Rating

5 stars
4 stars
3 stars
2 stars
1 star
(100 ratings)

Compatibility

+
=
Not enough data

2 people say it works.
1 person says it's broken.

Log in to vote.

100,2,2
100,1,1 100,1,1 100,1,1 100,1,1 100,1,1 100,1,1 100,1,1 100,1,1
100,1,1 100,1,1 100,1,1 100,1,1 100,1,1 100,1,1 100,1,1 100,1,1 100,1,1
33,3,1 100,1,1 100,1,1 100,1,1 100,1,1 100,1,1 100,1,1 100,1,1 100,1,1
75,8,6 100,1,1 100,1,1 100,1,1 100,1,1 100,1,1 100,1,1 100,1,1 100,1,1
67,3,2 100,1,1 100,1,1 100,1,1 100,1,1 100,1,1 100,1,1 100,1,1 100,1,1 0,1,0
100,1,1 100,1,1 100,1,1 100,1,1 100,1,1 100,1,1 100,1,1 100,1,1 100,1,1 100,1,1 100,1,1 100,1,1 100,1,1 100,1,1 100,1,1 100,1,1 100,1,1 100,1,1 100,1,1 100,1,1 100,1,1 100,1,1 100,1,1 100,1,1 100,1,1 100,1,1 100,2,2 100,2,2 100,1,1 100,1,1 100,3,3 100,9,9 100,14,14 89,9,8 100,8,8
100,2,2 100,1,1
100,1,1
100,1,1
100,2,2 100,4,4
100,1,1
100,2,2
0,3,0
10,10,1 50,4,2
21,14,3
50,2,1
67,3,2