Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

Update postmeta Parent when post_status child change

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:

  1. What does this PHP function code mean? [closed]
  2. what is the correct way to compare dates in a WP query_posts meta_query
  3. Restrict custom post type to only site administrator role
  4. Correctly delete posts with meta and attachments [duplicate]
  5. Linking Two Post Types
  6. How to force one column layout on custom post type edit page?
  7. How to change “Draft” string for status of custom post type to “Unavailable”?
  8. modify all posts of a category to “no comments allowed”
  9. Why is the »_builtin« parameter not advised in »register_post_type()« for custom post types?
  10. Showing current taxonomy terms
  11. automatically create taxonomy with same name as post title
  12. Assigning a role to a specific custom post type (and ignoring other post types)
  13. Display posts in random post types
  14. Custom Post Type by user
  15. saving custom post type data to different table in wordpress
  16. Query post types with multiple keys
  17. Having trouble with custom post type / meta box
  18. [Plugin: Posts 2 Posts] Changing display order of connections
  19. same archive template for different custom post
  20. How do I check if a posts status is set to draft or pending?
  21. Error after deleting Custom Post Type with a function (no trash used)
  22. Get all posts WHERE custom_field is LIKE value
  23. Get the post children count of a post
  24. How to delete all posts from a custom post type?
  25. Check Title Unique Or Not and If not error message and dont save
  26. Remove All, Published and Trashed Post Views in Custom Post Type
  27. Custom Post Type, Saving Multiple Checkboxes
  28. How to post twitter like updates on wordpress
  29. Show Two custom Post type and their posts on category page
  30. Custom search for custom post meta with pre_get_posts interferes with WP search
  31. apply filters only to specific post listing without check the url parameters
  32. Custom post type and body_class: Remove “blog” class
  33. WordPress Orderby Numeric Value Not Working
  34. Auto-generated posts not showing in backend (but being counted!)
  35. Deleting Custom Post type data using mySQL command
  36. Is there a way to have the view link on manage posts page to open in a new window or tab?
  37. Show the same Article Available in Other Categories
  38. Display only one post each WEEK
  39. List custom taxonomy specific to one custom post type
  40. Post image in WordPress not appearing on home page
  41. Meta query for custom post type ignored in main query
  42. changing meta value and meta key of price field
  43. Update Post Meta for a logged in user
  44. Two Custom Post Types Many to Many Relationship
  45. Show titles, date of all posts on single category page
  46. Allow users to create posts without logging in?
  47. How to define which register_post_status goes to which register_post_type?
  48. How to sort posts in a custom post type by title in ascending order by default?
  49. Get_the_terms restrict output
  50. Custom post type menu
  51. Published post auto change status to pending after 90 days
  52. YOAST SEO won’t work on custom post type archive [closed]
  53. Batch Extract Date from post title and put into ACF custom field
  54. Separate Content from gallery (custom post type)
  55. WordPress Count posts within a custom post type
  56. Custom post type tags not showing in search
  57. How set template for “custom post type” individual post
  58. Why is my custom post content only viewable when signed into WordPress?
  59. Get_post_custom not fetching value from array wordpress
  60. Add a form in every post and save data in post meta
  61. SELECT custom post type and its meta in SQL
  62. Save data is post using php front end
  63. Show custom post status when logged out
  64. Show posts from WP Custom Post Type selected from a field in a metabox
  65. edit.php all post not working
  66. Adding specific custom fields (images) to post excerpt
  67. How to properly get the wp_postmeta.meta_value of a custom post type in specifics?
  68. How to Disable option of meta field if that option is selected for any other post in custom post type?
  69. Stored meta from attachment, video length?
  70. Limit posts per page depending on the size of a div?
  71. Delete Post by User
  72. How to save post_status using action save_post?
  73. update a posts of other custom post type
  74. creating a custom post template
  75. Problem to get the link of the default ‘post’ post type like the orther custom types
  76. One Post with different content, depending on a Page
  77. Custom Post Type
  78. Custom Post Status & Taxonomies
  79. Edit post meta direct from post.php?
  80. How to create content automatically when a post is published?
  81. Display a post count from a custom metabox selection
  82. Display all post types together
  83. Turn post into simple slideshow
  84. Top 30 Songs using Custom Post Type
  85. Query multiple post of which one by taxonomy
  86. How to make a template for a specific post of a custom post type?
  87. How to delete unnecessary custom post types in the UI
  88. Automatically add custom taxonomy when meta value gets to a set number or beyond
  89. How to create a job post by email parsing? [closed]
  90. show posts under custom post type with same autj
  91. How to automate the creation of advanced layout article/post
  92. display posts, pages and custom post types from another wordpress site
  93. is therer any wordpress function to retrieve a specific html element from post content
  94. How to develop Knowledge center in WordPress Website
  95. I am having a problem with fetching product data in the Gutenberg block editor
  96. ACF – Tags not showing up in Custom Post Types
  97. Search everything (posts, pages, tags, cpt, meta)
  98. Displaying Meta Box Image
  99. Meta box with front-end styling
  100. Cannot use pages created on WP
Categories custom-post-types Tags custom-post-types, customization, post-meta, post-status, posts
How to Create a Parent of Pages But have it not link yet keep the URL Path?
Calling an attribute from a plugin shortcode

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress