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”
- How to remove a column from the Posts page
- Update post counts (published, draft, unattached) in admin interface
- How to display by default only published posts/pages in the admin area?
- Set Default Listing “View” in Admin
- Passing current cookies in wp_remote_get to get Draft Post Preview
- display all posts in wordpress admin
- Dynamically add id to heading tags
- Confirmation box when submitting post for review
- Ajax Load More Posts in Category Page
- Sends out email to admin
- How to remove duplicate sub-menu name for top level menu items in a plugin?
- Can I force a metabox to be in one column?
- Listen to Post action
- Add a new post status in the post progression
- Help! Turn php link data into url OR hide edit link in post admin OR hide drafts for all users except admin?
- Modifying admin sidebar contents to show pending posts indicator
- Publish pending article from front end with a button?
- List latest posts in WP-Admin
- Manipulate post category after time
- Any way to create a revision of a post ONLY with a new button in the Meta Box?
- 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
- Change slug with custom field
- Add “Post Options” for new wordpress post
- WooCommerce – Create Products Programatically [closed]
- How To Ignore a Filter On Applying Filter the Content In a Function
- Restrict access to post if it is currently being edited
- Handling error states with admin_post
- Post Admin – Filter by posts without tags
- Add javascript when post is published
- Getting an alphabetic post list with two letters onclick on letter
- Why does the_date work in the first custom column, but not in the second, in a series of customized Posts columns?
- Create new category upon save based on post information
- 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?
- Make “Post published. View post” Open in a New Tab
- Overview with latest edited posts and pages
- Hiding by default specific post status on backend list?
- Strange switch_to_blog() issue
- Custom colors for post rows based on post meta value
- How to add an admin function only to posts, not pages?
- POST from jQuery to PHP
- Search widget breaks when using multiple loops?
- Remove whitespace at the end of posts?
- Disable External Pingacks on WordPress Posts and Only Allow ‘Self Pings’
- Allow role to delete posts but block him the wp-admin
- Is there a way to change the color of a row in Post Administration based on the type of post?
- Add filter-by-tag in the all posts admin console page
- When is is_admin() available?
- Using radio button meta data from a custom meta box
- $post object is null
- How to get a nofication when post submitted
- New Plugin Review
- Advanced Custom Fields – Storing array value for further usage
- Function to show random posts from a category
- str_replace the_title(); blues
- 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
- Is it possible to change the admin posts per page view?
- How to store an extra (surrogate) ID when creating a post with wp_insert_post?
- Remove the Edit button in posts for permalinks on certain user roles? WP 3.3
- Global $post not working in OOP function WordPress
- Older entries link within a category page
- How do I display a full post, not just an excerpt?
- Remove read more
- Insert new post for each user infinite loop error
- Display the popular tags by default in the backend post edit page (without having to click on the link that displays them) [closed]
- WordPress Admin Tables in Post View
- Can I hide only one category from admin post list?
- Choose options via url
- List direct children of page
- Unable to get posts with category on my page
- wordpress radio button on single post page
- Admin moderates ALL comments (including post author)
- How *not* to show the last post on the latest posts list
- Create post from form with image
- Posts in Admin only display 1 Post instead of all
- Exclude a ‘portfolio’ custom category?
- Display a custom field rating system in the front end
- Hide the contents for specific post
- get value from post to sidebar
- Echo author slug in post edit page
- Adding a content rating system
- How to remove a specific script from bulk wordpress posts and images description?
- Error 404 blog/page/2/
- Post Format Status [closed]
- Onclick open posts displayed in slider in a popup [closed]
- How do I save JS classes being applied to the WP dashboard via custom plugin?
- Only an admin can add new tags
- WordPress as microblog: show excerpt instead of “(no title)” in posts view
- How can I catch WordPress custom settings page slug has already changed?
- Plugin or code to send out email to admin when a post is created