diff --git a/src/wp-admin/edit-comments.php b/src/wp-admin/edit-comments.php index 8a004b52265ef..29ec964924a4d 100644 --- a/src/wp-admin/edit-comments.php +++ b/src/wp-admin/edit-comments.php @@ -337,7 +337,7 @@ } if ( $spammed > 0 ) { - $ids = isset( $_REQUEST['ids'] ) ? $_REQUEST['ids'] : 0; + $ids = $_REQUEST['ids'] ?? 0; $messages[] = sprintf( /* translators: %s: Number of comments. */ @@ -359,7 +359,7 @@ } if ( $trashed > 0 ) { - $ids = isset( $_REQUEST['ids'] ) ? $_REQUEST['ids'] : 0; + $ids = $_REQUEST['ids'] ?? 0; $messages[] = sprintf( /* translators: %s: Number of comments. */ diff --git a/src/wp-admin/edit-form-advanced.php b/src/wp-admin/edit-form-advanced.php index 0380a48a9c735..a22acd74cc240 100644 --- a/src/wp-admin/edit-form-advanced.php +++ b/src/wp-admin/edit-form-advanced.php @@ -69,7 +69,7 @@ */ $post_ID = isset( $post_ID ) ? (int) $post_ID : 0; $user_ID = isset( $user_ID ) ? (int) $user_ID : 0; -$action = isset( $action ) ? $action : ''; +$action = $action ?? ''; if ( (int) get_option( 'page_for_posts' ) === $post->ID && empty( $post->post_content ) ) { add_action( 'edit_form_after_title', '_wp_posts_page_notice' ); diff --git a/src/wp-admin/includes/ajax-actions.php b/src/wp-admin/includes/ajax-actions.php index c3955b6d77cc6..2f3804a11b002 100644 --- a/src/wp-admin/includes/ajax-actions.php +++ b/src/wp-admin/includes/ajax-actions.php @@ -1808,7 +1808,7 @@ function wp_ajax_closed_postboxes() { $hidden = isset( $_POST['hidden'] ) ? explode( ',', $_POST['hidden'] ) : array(); $hidden = array_filter( $hidden ); - $page = isset( $_POST['page'] ) ? $_POST['page'] : ''; + $page = $_POST['page'] ?? ''; if ( sanitize_key( $page ) !== $page ) { wp_die( 0 ); @@ -1839,7 +1839,7 @@ function wp_ajax_closed_postboxes() { */ function wp_ajax_hidden_columns() { check_ajax_referer( 'screen-options-nonce', 'screenoptionnonce' ); - $page = isset( $_POST['page'] ) ? $_POST['page'] : ''; + $page = $_POST['page'] ?? ''; if ( sanitize_key( $page ) !== $page ) { wp_die( 0 ); @@ -1988,13 +1988,13 @@ function wp_ajax_menu_locations_save() { function wp_ajax_meta_box_order() { check_ajax_referer( 'meta-box-order' ); $order = isset( $_POST['order'] ) ? (array) $_POST['order'] : false; - $page_columns = isset( $_POST['page_columns'] ) ? $_POST['page_columns'] : 'auto'; + $page_columns = $_POST['page_columns'] ?? 'auto'; if ( 'auto' !== $page_columns ) { $page_columns = (int) $page_columns; } - $page = isset( $_POST['page'] ) ? $_POST['page'] : ''; + $page = $_POST['page'] ?? ''; if ( sanitize_key( $page ) !== $page ) { wp_die( 0 ); @@ -2052,7 +2052,7 @@ function wp_ajax_get_permalink() { function wp_ajax_sample_permalink() { check_ajax_referer( 'samplepermalink', 'samplepermalinknonce' ); $post_id = isset( $_POST['post_id'] ) ? (int) $_POST['post_id'] : 0; - $title = isset( $_POST['new_title'] ) ? $_POST['new_title'] : ''; + $title = $_POST['new_title'] ?? ''; $slug = isset( $_POST['new_slug'] ) ? $_POST['new_slug'] : null; wp_die( get_sample_permalink_html( $post_id, $title, $slug ) ); } diff --git a/src/wp-admin/includes/class-core-upgrader.php b/src/wp-admin/includes/class-core-upgrader.php index 5cb818cd59bd2..184376654295e 100644 --- a/src/wp-admin/includes/class-core-upgrader.php +++ b/src/wp-admin/includes/class-core-upgrader.php @@ -403,7 +403,7 @@ public static function should_update_to_version( $offered_ver ) { public function check_files() { global $wp_version, $wp_local_package; - $checksums = get_core_checksums( $wp_version, isset( $wp_local_package ) ? $wp_local_package : 'en_US' ); + $checksums = get_core_checksums( $wp_version, $wp_local_package ?? 'en_US' ); if ( ! is_array( $checksums ) ) { return false; diff --git a/src/wp-admin/includes/class-custom-image-header.php b/src/wp-admin/includes/class-custom-image-header.php index e8a16e47dc80a..fc4ce68549afe 100644 --- a/src/wp-admin/includes/class-custom-image-header.php +++ b/src/wp-admin/includes/class-custom-image-header.php @@ -1351,7 +1351,7 @@ final public function create_attachment_object( $cropped, $parent_attachment_id * @return int Attachment ID. */ final public function insert_attachment( $attachment, $cropped ) { - $parent_id = isset( $attachment['post_parent'] ) ? $attachment['post_parent'] : null; + $parent_id = $attachment['post_parent'] ?? null; unset( $attachment['post_parent'] ); $attachment_id = wp_insert_attachment( $attachment, $cropped ); @@ -1584,8 +1584,8 @@ public function get_uploaded_header_images() { foreach ( $header_images as &$header_image ) { $header_meta = get_post_meta( $header_image['attachment_id'] ); - $header_image['timestamp'] = isset( $header_meta[ $timestamp_key ] ) ? $header_meta[ $timestamp_key ] : ''; - $header_image['alt_text'] = isset( $header_meta[ $alt_text_key ] ) ? $header_meta[ $alt_text_key ] : ''; + $header_image['timestamp'] = $header_meta[ $timestamp_key ] ?? ''; + $header_image['alt_text'] = $header_meta[ $alt_text_key ] ?? ''; } return $header_images; diff --git a/src/wp-admin/includes/class-plugin-installer-skin.php b/src/wp-admin/includes/class-plugin-installer-skin.php index aa97833c59a85..13b4dd7097cc9 100644 --- a/src/wp-admin/includes/class-plugin-installer-skin.php +++ b/src/wp-admin/includes/class-plugin-installer-skin.php @@ -45,7 +45,7 @@ public function __construct( $args = array() ) { $this->type = $args['type']; $this->url = $args['url']; - $this->api = isset( $args['api'] ) ? $args['api'] : array(); + $this->api = $args['api'] ?? array(); $this->overwrite = $args['overwrite']; parent::__construct( $args ); @@ -265,8 +265,8 @@ private function do_overwrite() { $blocked_message = '

' . esc_html__( 'The plugin cannot be updated due to the following:' ) . '

'; $blocked_message .= '