From a605a91b9128a69ddbb16906fe43c1ad8ce2f6a4 Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Wed, 13 Sep 2023 16:59:15 +0300 Subject: [PATCH] - WPCS; --- includes/admin/core/class-admin-metabox.php | 35 +++++++++++---------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/includes/admin/core/class-admin-metabox.php b/includes/admin/core/class-admin-metabox.php index ff353493..83d2ea0b 100644 --- a/includes/admin/core/class-admin-metabox.php +++ b/includes/admin/core/class-admin-metabox.php @@ -1,13 +1,14 @@ admin()->sanitize_form_meta( $_POST['form'] ); foreach ( $form_meta as $k => $v ) { - if ( strstr( $k, '_um_' ) ) { - if ( $k === '_um_is_default' ) { + if ( 0 === strpos( $k, '_um_' ) ) { + if ( '_um_is_default' === $k ) { $mode = UM()->query()->get_attr( 'mode', $post_id ); if ( ! empty( $mode ) ) { - $posts = $wpdb->get_col( $wpdb->prepare( - "SELECT post_id - FROM {$wpdb->postmeta} - WHERE meta_key = '_um_mode' AND - meta_value = %s", - $mode - ) ); + $posts = $wpdb->get_col( + $wpdb->prepare( + "SELECT post_id + FROM {$wpdb->postmeta} + WHERE meta_key = '_um_mode' AND + meta_value = %s", + $mode + ) + ); foreach ( $posts as $p_id ) { delete_post_meta( $p_id, '_um_is_default' ); } @@ -1217,10 +1220,8 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) { update_post_meta( $post_id, $k, $v ); } } - } - /** * Load modal content */