From WP 3.7 you have the option to hook to the save_post
hook directly for you post_type.
For example:
function update_post_parent_status_on_complete( $post_id ) {
if(!isset($post))
$post = get_post($post_id);
// checking the status you want and also that has a parent
if ($post->post_status == 'completed' && $post->post_parent !=0 ){
$parent_id = $post->post_parent;
update_post_meta($parent_id, 'screening_status', 'screen');
}
}
add_action('save_post_screening', 'update_post_parent_status_on_complete');
Related Posts:
- What does this PHP function code mean? [closed]
- what is the correct way to compare dates in a WP query_posts meta_query
- Restrict custom post type to only site administrator role
- Correctly delete posts with meta and attachments [duplicate]
- Linking Two Post Types
- How to force one column layout on custom post type edit page?
- How to change “Draft” string for status of custom post type to “Unavailable”?
- modify all posts of a category to “no comments allowed”
- Why is the »_builtin« parameter not advised in »register_post_type()« for custom post types?
- Showing current taxonomy terms
- automatically create taxonomy with same name as post title
- Assigning a role to a specific custom post type (and ignoring other post types)
- Display posts in random post types
- Custom Post Type by user
- saving custom post type data to different table in wordpress
- Query post types with multiple keys
- Having trouble with custom post type / meta box
- [Plugin: Posts 2 Posts] Changing display order of connections
- same archive template for different custom post
- How do I check if a posts status is set to draft or pending?
- Error after deleting Custom Post Type with a function (no trash used)
- Get all posts WHERE custom_field is LIKE value
- Get the post children count of a post
- How to delete all posts from a custom post type?
- Check Title Unique Or Not and If not error message and dont save
- Remove All, Published and Trashed Post Views in Custom Post Type
- Custom Post Type, Saving Multiple Checkboxes
- How to post twitter like updates on wordpress
- Show Two custom Post type and their posts on category page
- Custom search for custom post meta with pre_get_posts interferes with WP search
- apply filters only to specific post listing without check the url parameters
- Custom post type and body_class: Remove “blog” class
- WordPress Orderby Numeric Value Not Working
- Auto-generated posts not showing in backend (but being counted!)
- Deleting Custom Post type data using mySQL command
- Is there a way to have the view link on manage posts page to open in a new window or tab?
- Show the same Article Available in Other Categories
- Display only one post each WEEK
- List custom taxonomy specific to one custom post type
- Post image in WordPress not appearing on home page
- Meta query for custom post type ignored in main query
- changing meta value and meta key of price field
- Update Post Meta for a logged in user
- Two Custom Post Types Many to Many Relationship
- Show titles, date of all posts on single category page
- Allow users to create posts without logging in?
- How to define which register_post_status goes to which register_post_type?
- How to sort posts in a custom post type by title in ascending order by default?
- Get_the_terms restrict output
- Custom post type menu
- Published post auto change status to pending after 90 days
- YOAST SEO won’t work on custom post type archive [closed]
- Batch Extract Date from post title and put into ACF custom field
- Separate Content from gallery (custom post type)
- WordPress Count posts within a custom post type
- Custom post type tags not showing in search
- How set template for “custom post type” individual post
- Why is my custom post content only viewable when signed into WordPress?
- Get_post_custom not fetching value from array wordpress
- Add a form in every post and save data in post meta
- SELECT custom post type and its meta in SQL
- Save data is post using php front end
- Show custom post status when logged out
- Show posts from WP Custom Post Type selected from a field in a metabox
- edit.php all post not working
- Adding specific custom fields (images) to post excerpt
- How to properly get the wp_postmeta.meta_value of a custom post type in specifics?
- How to Disable option of meta field if that option is selected for any other post in custom post type?
- Stored meta from attachment, video length?
- Limit posts per page depending on the size of a div?
- Delete Post by User
- How to save post_status using action save_post?
- update a posts of other custom post type
- creating a custom post template
- Problem to get the link of the default ‘post’ post type like the orther custom types
- One Post with different content, depending on a Page
- Custom Post Type
- Custom Post Status & Taxonomies
- Edit post meta direct from post.php?
- How to create content automatically when a post is published?
- Display a post count from a custom metabox selection
- Display all post types together
- Turn post into simple slideshow
- Top 30 Songs using Custom Post Type
- Query multiple post of which one by taxonomy
- How to make a template for a specific post of a custom post type?
- How to delete unnecessary custom post types in the UI
- Automatically add custom taxonomy when meta value gets to a set number or beyond
- How to create a job post by email parsing? [closed]
- show posts under custom post type with same autj
- How to automate the creation of advanced layout article/post
- display posts, pages and custom post types from another wordpress site
- is therer any wordpress function to retrieve a specific html element from post content
- How to develop Knowledge center in WordPress Website
- Custom Post Type: Set post_title equal to a custom post type field
- I can’t set meta_key in my custom post type query
- Displaying One Custom Post Type’s Content On Single Post of Another Custom Post Type
- Add Class After 4th Post
- Convert attribute woocommerce terms (taxonomy terms) in posts of custom post type
- Add category slug as class attribute in a link array