Skip to content

Commit

Permalink
Add check for metabox save call
Browse files Browse the repository at this point in the history
  • Loading branch information
Imran92 committed Apr 8, 2024
1 parent 45c7eb2 commit 8eda32e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion includes/admin/class-sensei-course-pre-publish-panel.php
Expand Up @@ -100,7 +100,10 @@ public function maybe_publish_lessons( $course_id, $post, $old_status ) {
return;
}

if ( ! $is_main_publish_call ) {
$uri = isset( $_SERVER['REQUEST_URI'] ) ? esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : '';
$is_metabox_save_call = strpos( $uri, 'meta-box-loader=1' ) > 0;

if ( ! $is_main_publish_call && ! $is_metabox_save_call ) {
// If it's not the main publish call, then it's the structure saving call that comes immediately after the main publish call.
// So we can remove the flag now, because after this iteraction, the whole publishing cycle is complete.
delete_post_meta( $course_id, $publishing_meta_key );
Expand Down

0 comments on commit 8eda32e

Please sign in to comment.