diff --git a/core/classes/Controller/Post_Type.php b/core/classes/Controller/Post_Type.php index 0d24024..8b46142 100644 --- a/core/classes/Controller/Post_Type.php +++ b/core/classes/Controller/Post_Type.php @@ -319,10 +319,27 @@ public function save_post( $post_id ) { # Gather all post types foreach( $combination[ 'locations' ] as $location ) { + $enqueue = false; + $post_types = $location->get_post_types(); + $ids = $location->get_ids(); + $parents = $location->get_parents(); # Check if the container is being saved - if( ! in_array( $post->post_type, $post_types ) ) { + if( ! empty( $post_types ) && ! in_array( $post->post_type, $post_types ) ) { + continue; + } + + # Check for IDs + if( empty( $post_types ) && empty( $ids ) && empty( $parents ) ) { + continue; + } + + if( ! empty( $ids ) && ! $location->check_single_value( $post_id, $ids ) ) { + continue; + } + + if( ! empty( $parents ) && ! $location->check_single_value( $post_id, $parents ) ) { continue; } diff --git a/core/classes/Location/Post_Type.php b/core/classes/Location/Post_Type.php index 4441a22..34925c3 100644 --- a/core/classes/Location/Post_Type.php +++ b/core/classes/Location/Post_Type.php @@ -531,6 +531,18 @@ public function works_with( $source ) { return false; } + if( ! empty( $this->ids ) ) { + return $this->check_single_value( $post->ID, $this->ids ) + ? $post + : false; + } + + if( ! empty( $this->parents ) ) { + return $this->check_single_value( $post->ID, $this->parents ) + ? $post + : false; + } + # Check the post type if( ! in_array( $post->post_type, $this->post_types ) ) { return false;