Recipe_Post_Utilities::draft_triggers_actions( $post_ID )
Draft all children triggers and actions of recipe
Contents
Parameters Parameters
- $post_ID
-
(Required)
Source Source
File: src/core/automator-post-types/uo-recipe/class-recipe-post-utilities.php
public function draft_triggers_actions( $post_ID ) { $post = get_post( $post_ID ); if ( $post && 'uo-recipe' === $post->post_type ) { $args = array( 'post_parent' => $post->ID, 'post_status' => 'any', 'post_type' => 'uo-trigger', 'posts_per_page' => 999, //phpcs:ignore WordPress.WP.PostsPerPage.posts_per_page_posts_per_page ); $children = get_children( $args ); if ( is_array( $children ) && count( $children ) > 0 ) { // Delete all the Children of the Parent Page foreach ( $children as $child ) { $child_update = array( 'ID' => $child->ID, 'post_status' => 'draft', ); wp_update_post( $child_update ); } } $args = array( 'post_parent' => $post->ID, 'post_status' => 'any', 'post_type' => 'uo-action', 'posts_per_page' => 999, //phpcs:ignore WordPress.WP.PostsPerPage.posts_per_page_posts_per_page ); $children = get_children( $args ); if ( is_array( $children ) && count( $children ) > 0 ) { // Delete all the Children of the Parent Page foreach ( $children as $child ) { $child_update = array( 'ID' => $child->ID, 'post_status' => 'draft', ); wp_update_post( $child_update ); } } $args = array( 'post_parent' => $post->ID, 'post_status' => 'any', 'post_type' => 'uo-closure', 'posts_per_page' => 999, //phpcs:ignore WordPress.WP.PostsPerPage.posts_per_page_posts_per_page ); $children = get_children( $args ); if ( is_array( $children ) && count( $children ) > 0 ) { // Delete all the Children of the Parent Page foreach ( $children as $child ) { $child_update = array( 'ID' => $child->ID, 'post_status' => 'draft', ); wp_update_post( $child_update ); } } } }
Expand full source code Collapse full source code View on Github