Skip to content

Commit

Permalink
Fix: Don't show 'Label added' message if label data is empty (#374)
Browse files Browse the repository at this point in the history
  • Loading branch information
burhandodhy authored Feb 13, 2024
1 parent b35126f commit 9e68966
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions includes/class-bc-labels.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,15 @@ public function add_label() {
) {
$label_name = sanitize_text_field( $_POST['label-name'] );
$label_path = ! empty( $_POST['label-path'] ) ? $_POST['label-path'] : '';
$this->cms_api->add_label( $label_name, $label_path );
wp_safe_redirect( admin_url( 'admin.php?page=brightcove-labels&add_label=1&refresh_labels=1' ) );

$redirect_url = admin_url( 'admin.php?page=brightcove-labels&refresh_labels=1' );

if ( ! empty( $label_name ) || ! empty( $label_path ) ) {
$this->cms_api->add_label( $label_name, $label_path );
$redirect_url = add_query_arg( 'add_label', '1', $redirect_url );
}

wp_safe_redirect( $redirect_url );
exit;
}
}
Expand Down

0 comments on commit 9e68966

Please sign in to comment.