You could hook into publish_post like the plugin Inform about Content does.
But this hook is fired on updates to published posts too, this may result in many redundant tweets …
Try 'draft_to_publish' instead. It is called in wp_transition_post_status() and happens only one time. You get the $post object as argument.
Prototype, not tested:
add_action( 'draft_to_publish', 'wpse_55516_tweet_new_post' );
function wpse_55516_tweet_new_post( $post )
{
if ( 'post' !== $post->post_type )
{
return;
}
// Tweet it like a boss …
}
Related Posts:
- prevent showing posts of an specific category in admin posts section
- How to add an admin notice upon post save/update
- How to change the case of all post titles to “Title Case”
- Update post counts (published, draft, unattached) in admin interface
- How to display by default only published posts/pages in the admin area?
- display all posts in wordpress admin
- Ajax Load More Posts in Category Page
- How to remove duplicate sub-menu name for top level menu items in a plugin?
- Help! Turn php link data into url OR hide edit link in post admin OR hide drafts for all users except admin?
- Manipulate post category after time
- Update all posts automatically when using post_meta
- using slug instead of ID in admin edit post url
- Restrict users from editing post based on the age of the post
- How to Load Scripts and CSS for Admins Only When Editing or Adding Posts
- WooCommerce – Create Products Programatically [closed]
- Handling error states with admin_post
- Post Admin – Filter by posts without tags
- Add javascript when post is published
- Add link on the top menu of the post table?
- Add a special filter link to All Posts in admin
- Cannot access current post’s ID in custom plugin
- Set number of article per number of page
- How to change post status from publish to draft using hook in wordpress?
- Overview with latest edited posts and pages
- Hiding by default specific post status on backend list?
- Custom colors for post rows based on post meta value
- How to add an admin function only to posts, not pages?
- Allow role to delete posts but block him the wp-admin
- When is is_admin() available?
- Function to show random posts from a category
- How do I add a custom body class to the admin area of a page?
- Adding a text link under the post title in the lists of posts
- Remove the Edit button in posts for permalinks on certain user roles? WP 3.3
- how to set beforsend option in wordpress ajax methods
- Show info to author only
- Display post category in foreach loop with category link
- How to get post bulk edit action trigger and get edited post ids?
- Why WP_Query(‘showposts=5’) shows only 1 post?
- Most liked page not displaying posts
- How to make number of blog posts a custom field?
- updating a post doesn’t trigger a function
- Hide a specific category in admin All Posts page (WordPress)
- Updating post data on save (save_post vs wp_insert_post_data)
- Change target of view link in admin
- Publish post’s date is set to Nov 30 -0001
- List authors with the last post title and order by last post date
- plugin to post from admin to flickr [closed]
- Redirect to another page using contact form 7? [closed]
- All Posts admin screen – show time underneath the ‘Date’?
- Display post category in foreach loop
- Get post ID in post/page edit area
- What happens if I delete all the rows that represents a post revision from the posts table into WordPress database?
- Page template is accessing the incorrect posts?
- How to remove specific tag from multiple posts?
- How to detect when admin user is on the All Posts page?
- Get post meta retrieving wrong value
- All posts display default index.html
- How can I add a box to edit Order on a regular post?
- Filtering posts on Post Administration Page by Week Number instead of by Month
- Filter Hook for post table (not columns)
- How to add convenient buttons for new custom post statuses
- Stop post submission without losing data?
- Cant’ Grab WordPress Built-in Posts Through Loop
- How to show 3 most recent/viewed posts in a special tiles on home page using wordpress?
- How can my plugin display a populated new post window
- search content of pages and list in wp-admin
- How to display only one category in a custom post type?
- Display message depending on capability outside loop
- Limiting the amount of posts retrieved by the loop
- Insert specific information to a posts of a predefined category
- Adjust the order for returned posts
- Is it possible to get the specific content on the search page?
- Post form – AJAX won’t upload featured image – Plugin development
- How can I see $post object in frontend from functions.php?
- Prefix WordPress Taxonomy Tags With Hashtag Symbol Like Twitter
- Put page on Archived statut after end of publication date
- Add view to admin menu to filter for specific criteria ( If post is child of specific Parent )
- How do I change the post title’s link on the posts page?
- Ajax the create and edit post form into lightbox and get results
- Setting at job with shortcode not working
- Get content and send to 3rd party
- Creating widget – ask for selecting a post in the admin panel
- issue in wordpress auto delete post and redirect to another 1
- How to change the publishing date of each posts?
- How to limit the number of results for all query_posts on mysite
- Get first comment link on the post itself
- Is possible to create a custom link that creates a post that’s already categorized?
- User driven content problems
- How can i retrive the movies, trailers, news in a single page using search
- How can I create a menu items from meta box based on users input
- How do I display a full post, not just an excerpt?
- Remove read more
- Choose options via url
- Admin moderates ALL comments (including post author)
- How *not* to show the last post on the latest posts list
- Hide the contents for specific post
- get value from post to sidebar
- Error 404 blog/page/2/
- Only an admin can add new tags
- Plugin or code to send out email to admin when a post is created