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
- 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
- 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
- Can I force a metabox to be in one column?
- Add a new post status in the post progression
- Modifying admin sidebar contents to show pending posts indicator
- List latest posts in WP-Admin
- Any way to create a revision of a post ONLY with a new button in the Meta Box?
- using slug instead of ID in admin edit post url
- Change slug with custom field
- Add “Post Options” for new wordpress post
- WooCommerce – Create Products Programatically [closed]
- Restrict access to post if it is currently being edited
- Getting an alphabetic post list with two letters onclick on letter
- Create new category upon save based on post information
- Strange switch_to_blog() issue
- How to add an admin function only to posts, not pages?
- POST from jQuery to PHP
- Remove whitespace at the end of posts?
- Disable External Pingacks on WordPress Posts and Only Allow ‘Self Pings’
- 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
- str_replace the_title(); blues
- 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?
- Change default Posts page
- How to get post bulk edit action trigger and get edited post ids?
- Disable inline_edit() on edit.php
- WordPress Custom Fields (Checkboxes with multiple values)
- Prevent Delete Attachment by URL or When Submit
- What hook do you use to update a post?
- Change target of view link in admin
- WP Admin register taxonomy and post type performance
- Creating a post from data returned from HTML form
- Can’t get full post title if there a spaces in title
- Adding a user’s ID behind the tag ref link address
- How can I remove the first two words and shorten get_the_title()
- How to add the time of a post to the list of posts on the administration page?
- why str_replace targeting pages instead just targeting post?
- I don’t want the complete article to show on homepage
- Get author posts count after excluding a category
- Dark Bar at the top of wordpress page can’t be seen?
- How to add PHP code snippet to all Post pages?
- Finding a post’s slug
- Hide content from Post Preview
- How to get the next and previous image title from attachment or gallery?
- Open a wordpress single post in a lightbox without the header and footer
- Send email to admin with post author
- displaying the categories post
- How To Use Custom Fields With .mp3 Links
- Categories Listing and Highlighting current category item
- In admin panel, use a form to create a post?
- A better code for no post format?
- Help Combine These Two PHP Codes
- Add checkbox in admin post list – show checked post in widget
- Cannot create new posts or upload images using media manager
- How to create admin setting for this small plugin
- How to Send Pingbacks for all Posts in WordPress?
- Ignore posts content in the posts queries for internal linking
- WordPress: Develop multiple posts with different data
- How do I scope out why I have two “posts” menus in an admin?
- Update user meta when post published no working
- Fixing the WP Post Object for Custom Route
- Displaying friend’s posts only
- Export Posts with specific custom fields by sql
- Dynamic form variables for post meta
- Custom plugin to get related posts by category
- Show a Category Specific Info Box
- How to get all the terms of a post
- Why is $_POST Empty in Profile Edit Admin?
- Older entries link within a category page
- 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?
- List direct children of page
- Unable to get posts with category on my page
- wordpress radio button on single post page
- 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
- Adding a content rating system
- How to remove a specific script from bulk wordpress posts and images description?
- Post Format Status [closed]
- Onclick open posts displayed in slider in a popup [closed]