Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
87f0388
Use null coalescing operator for remaining uses of isset()
westonruter Dec 23, 2025
9021455
Merge branch 'trunk' into trac-63430-null-coalescing
westonruter Jan 3, 2026
401b338
Replace remaining instances outside of ID3 and block-library
westonruter Jan 3, 2026
5a69db2
Revert erroneous replacements
westonruter Jan 3, 2026
59ccd14
Revert change to class-wp-block-parser-frame.php since comes from Gut…
westonruter Jan 3, 2026
362c178
Move line-initial null coalescing operator to end of previous line
westonruter Jan 3, 2026
0be1779
Merge branch 'trunk' @ r61424 into trac-63430-null-coalescing
westonruter Jan 3, 2026
d4ef0ca
Merge branch 'trunk' into trac-63430-null-coalescing
westonruter Jan 5, 2026
d37d630
Apply REST API changes from https://github.com/WordPress/wordpress-de…
westonruter Jan 5, 2026
357f21d
Merge branch 'trunk' @ r61429 of https://github.com/WordPress/wordpre…
westonruter Jan 5, 2026
b9cd4f7
Merge branch 'trunk' @ r61430 into trac-63430-null-coalescing
westonruter Jan 5, 2026
a4e428e
Remove needless parentheses and line breaks
westonruter Jan 5, 2026
35f17d6
Fix syntax error
westonruter Jan 5, 2026
ac277b2
Merge branch 'trunk' @ r61431 into trac-63430-null-coalescing
westonruter Jan 5, 2026
1a2a173
Merge branch 'trunk' @ r61432 into trac-63430-null-coalescing
westonruter Jan 5, 2026
92eae34
Merge branch 'trunk' @ r61433 into trac-63430-null-coalescing
westonruter Jan 5, 2026
ef8a226
Merge branch 'trunk' @ r61435 into trac-63430-null-coalescing
westonruter Jan 5, 2026
13bacde
Merge branch 'trunk' @ r61436 into trac-63430-null-coalescing
westonruter Jan 5, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions src/wp-admin/includes/ajax-actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -2052,8 +2052,8 @@ 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'] : '';
$slug = isset( $_POST['new_slug'] ) ? $_POST['new_slug'] : null;
$title = $_POST['new_title'] ?? '';
$slug = $_POST['new_slug'] ?? null;
wp_die( get_sample_permalink_html( $post_id, $title, $slug ) );
}

Expand Down Expand Up @@ -2393,7 +2393,7 @@ function wp_ajax_save_widget() {
$error = '<p>' . __( 'An error has occurred. Please reload the page and try again.' ) . '</p>';

$sidebars = wp_get_sidebars_widgets();
$sidebar = isset( $sidebars[ $sidebar_id ] ) ? $sidebars[ $sidebar_id ] : array();
$sidebar = $sidebars[ $sidebar_id ] ?? array();

// Delete.
if ( isset( $_POST['delete_widget'] ) && $_POST['delete_widget'] ) {
Expand Down Expand Up @@ -3353,12 +3353,12 @@ function wp_ajax_send_attachment_to_editor() {
remove_filter( 'media_send_to_editor', 'image_media_send_to_editor' );

if ( str_starts_with( $post->post_mime_type, 'image' ) ) {
$align = isset( $attachment['align'] ) ? $attachment['align'] : 'none';
$size = isset( $attachment['image-size'] ) ? $attachment['image-size'] : 'medium';
$alt = isset( $attachment['image_alt'] ) ? $attachment['image_alt'] : '';
$align = $attachment['align'] ?? 'none';
$size = $attachment['image-size'] ?? 'medium';
$alt = $attachment['image_alt'] ?? '';

// No whitespace-only captions.
$caption = isset( $attachment['post_excerpt'] ) ? $attachment['post_excerpt'] : '';
$caption = $attachment['post_excerpt'] ?? '';
if ( '' === trim( $caption ) ) {
$caption = '';
}
Expand All @@ -3368,7 +3368,7 @@ function wp_ajax_send_attachment_to_editor() {
} elseif ( wp_attachment_is( 'video', $post ) || wp_attachment_is( 'audio', $post ) ) {
$html = stripslashes_deep( $_POST['html'] );
} else {
$html = isset( $attachment['post_title'] ) ? $attachment['post_title'] : '';
$html = $attachment['post_title'] ?? '';
$rel = $rel ? ' rel="attachment wp-att-' . $id . '"' : ''; // Hard-coded string, $id is already sanitized.

if ( ! empty( $url ) ) {
Expand Down Expand Up @@ -3421,7 +3421,7 @@ function wp_ajax_send_link_to_editor() {
$link_text = wp_basename( $src );
}

$post = get_post( isset( $_POST['post_id'] ) ? $_POST['post_id'] : 0 );
$post = get_post( $_POST['post_id'] ?? 0 );

// Ping WordPress for an embed.
$check_embed = $wp_embed->run_shortcode( '[embed]' . $src . '[/embed]' );
Expand Down Expand Up @@ -3647,7 +3647,7 @@ function wp_ajax_query_themes() {
}
}

$old_filter = isset( $args['browse'] ) ? $args['browse'] : 'search';
$old_filter = $args['browse'] ?? 'search';

/** This filter is documented in wp-admin/includes/class-wp-theme-install-list-table.php */
$args = apply_filters( 'install_themes_table_api_args_' . $old_filter, $args );
Expand Down
2 changes: 1 addition & 1 deletion src/wp-admin/includes/class-core-upgrader.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/wp-admin/includes/class-custom-image-header.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/wp-admin/includes/class-language-pack-upgrader.php
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ public function bulk_upgrade( $language_updates = array(), $args = array() ) {
$language_updates_results[] = array(
'language' => $language_update->language,
'type' => $language_update->type,
'slug' => isset( $language_update->slug ) ? $language_update->slug : 'default',
'slug' => $language_update->slug ?? 'default',
'version' => $language_update->version,
);
}
Expand Down
6 changes: 3 additions & 3 deletions src/wp-admin/includes/class-plugin-installer-skin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down Expand Up @@ -265,8 +265,8 @@ private function do_overwrite() {
$blocked_message = '<p>' . esc_html__( 'The plugin cannot be updated due to the following:' ) . '</p>';
$blocked_message .= '<ul class="ul-disc">';

$requires_php = isset( $new_plugin_data['RequiresPHP'] ) ? $new_plugin_data['RequiresPHP'] : null;
$requires_wp = isset( $new_plugin_data['RequiresWP'] ) ? $new_plugin_data['RequiresWP'] : null;
$requires_php = $new_plugin_data['RequiresPHP'] ?? null;
$requires_wp = $new_plugin_data['RequiresWP'] ?? null;

if ( ! is_php_version_compatible( $requires_php ) ) {
$error = sprintf(
Expand Down
12 changes: 6 additions & 6 deletions src/wp-admin/includes/class-plugin-upgrader.php
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,8 @@ public function check_package( $source ) {
return new WP_Error( 'incompatible_archive_no_plugins', $this->strings['incompatible_archive'], __( 'No valid plugins were found.' ) );
}

$requires_php = isset( $new_plugin_data['RequiresPHP'] ) ? $new_plugin_data['RequiresPHP'] : null;
$requires_wp = isset( $new_plugin_data['RequiresWP'] ) ? $new_plugin_data['RequiresWP'] : null;
$requires_php = $new_plugin_data['RequiresPHP'] ?? null;
$requires_wp = $new_plugin_data['RequiresWP'] ?? null;

if ( ! is_php_version_compatible( $requires_php ) ) {
$error = sprintf(
Expand Down Expand Up @@ -570,7 +570,7 @@ public function deactivate_plugin_before_upgrade( $response, $plugin ) {
return $response;
}

$plugin = isset( $plugin['plugin'] ) ? $plugin['plugin'] : '';
$plugin = $plugin['plugin'] ?? '';
if ( empty( $plugin ) ) {
return new WP_Error( 'bad_request', $this->strings['bad_request'] );
}
Expand Down Expand Up @@ -604,7 +604,7 @@ public function active_before( $response, $plugin ) {
return $response;
}

$plugin = isset( $plugin['plugin'] ) ? $plugin['plugin'] : '';
$plugin = $plugin['plugin'] ?? '';

// Only run if plugin is active.
if ( ! is_plugin_active( $plugin ) ) {
Expand Down Expand Up @@ -640,7 +640,7 @@ public function active_after( $response, $plugin ) {
return $response;
}

$plugin = isset( $plugin['plugin'] ) ? $plugin['plugin'] : '';
$plugin = $plugin['plugin'] ?? '';

// Only run if plugin is active.
if ( ! is_plugin_active( $plugin ) ) {
Expand Down Expand Up @@ -679,7 +679,7 @@ public function delete_old_plugin( $removed, $local_destination, $remote_destina
return $removed; // Pass errors through.
}

$plugin = isset( $plugin['plugin'] ) ? $plugin['plugin'] : '';
$plugin = $plugin['plugin'] ?? '';
if ( empty( $plugin ) ) {
return new WP_Error( 'bad_request', $this->strings['bad_request'] );
}
Expand Down
6 changes: 3 additions & 3 deletions src/wp-admin/includes/class-theme-installer-skin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down Expand Up @@ -310,8 +310,8 @@ private function do_overwrite() {
$blocked_message = '<p>' . esc_html__( 'The theme cannot be updated due to the following:' ) . '</p>';
$blocked_message .= '<ul class="ul-disc">';

$requires_php = isset( $new_theme_data['RequiresPHP'] ) ? $new_theme_data['RequiresPHP'] : null;
$requires_wp = isset( $new_theme_data['RequiresWP'] ) ? $new_theme_data['RequiresWP'] : null;
$requires_php = $new_theme_data['RequiresPHP'] ?? null;
$requires_wp = $new_theme_data['RequiresWP'] ?? null;

if ( ! is_php_version_compatible( $requires_php ) ) {
$error = sprintf(
Expand Down
8 changes: 4 additions & 4 deletions src/wp-admin/includes/class-theme-upgrader.php
Original file line number Diff line number Diff line change
Expand Up @@ -639,8 +639,8 @@ public function check_package( $source ) {
);
}

$requires_php = isset( $new_theme_data['RequiresPHP'] ) ? $new_theme_data['RequiresPHP'] : null;
$requires_wp = isset( $new_theme_data['RequiresWP'] ) ? $new_theme_data['RequiresWP'] : null;
$requires_php = $new_theme_data['RequiresPHP'] ?? null;
$requires_wp = $new_theme_data['RequiresWP'] ?? null;

if ( ! is_php_version_compatible( $requires_php ) ) {
$error = sprintf(
Expand Down Expand Up @@ -685,7 +685,7 @@ public function current_before( $response, $theme ) {
return $response;
}

$theme = isset( $theme['theme'] ) ? $theme['theme'] : '';
$theme = $theme['theme'] ?? '';

// Only run if active theme.
if ( get_stylesheet() !== $theme ) {
Expand Down Expand Up @@ -717,7 +717,7 @@ public function current_after( $response, $theme ) {
return $response;
}

$theme = isset( $theme['theme'] ) ? $theme['theme'] : '';
$theme = $theme['theme'] ?? '';

// Only run if active theme.
if ( get_stylesheet() !== $theme ) {
Expand Down
2 changes: 1 addition & 1 deletion src/wp-admin/includes/class-wp-community-events.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public function get_events( $location_search = '', $timezone = '' ) {
} elseif ( ! isset( $response_body['location'], $response_body['events'] ) ) {
$response_error = new WP_Error(
'api-invalid-response',
isset( $response_body['error'] ) ? $response_body['error'] : __( 'Unknown API error.' )
$response_body['error'] ?? __( 'Unknown API error.' )
);
}

Expand Down
4 changes: 2 additions & 2 deletions src/wp-admin/includes/class-wp-debug-data.php
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,8 @@ private static function get_wp_server(): array {
);
$fields['httpd_software'] = array(
'label' => __( 'Web server' ),
'value' => ( isset( $_SERVER['SERVER_SOFTWARE'] ) ? $_SERVER['SERVER_SOFTWARE'] : __( 'Unable to determine what web server software is used' ) ),
'debug' => ( isset( $_SERVER['SERVER_SOFTWARE'] ) ? $_SERVER['SERVER_SOFTWARE'] : 'unknown' ),
'value' => ( $_SERVER['SERVER_SOFTWARE'] ?? __( 'Unable to determine what web server software is used' ) ),
'debug' => ( $_SERVER['SERVER_SOFTWARE'] ?? 'unknown' ),
);
$fields['php_version'] = array(
'label' => __( 'PHP version' ),
Expand Down
2 changes: 1 addition & 1 deletion src/wp-admin/includes/class-wp-links-list-table.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function __construct( $args = array() ) {
parent::__construct(
array(
'plural' => 'bookmarks',
'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
'screen' => $args['screen'] ?? null,
)
);
}
Expand Down
20 changes: 10 additions & 10 deletions src/wp-admin/includes/class-wp-list-table.php
Original file line number Diff line number Diff line change
Expand Up @@ -1451,11 +1451,11 @@ public function print_column_headers( $with_id = true ) {
}

if ( isset( $sortable[ $column_key ] ) ) {
$orderby = isset( $sortable[ $column_key ][0] ) ? $sortable[ $column_key ][0] : '';
$desc_first = isset( $sortable[ $column_key ][1] ) ? $sortable[ $column_key ][1] : false;
$abbr = isset( $sortable[ $column_key ][2] ) ? $sortable[ $column_key ][2] : '';
$orderby_text = isset( $sortable[ $column_key ][3] ) ? $sortable[ $column_key ][3] : '';
$initial_order = isset( $sortable[ $column_key ][4] ) ? $sortable[ $column_key ][4] : '';
$orderby = $sortable[ $column_key ][0] ?? '';
$desc_first = $sortable[ $column_key ][1] ?? false;
$abbr = $sortable[ $column_key ][2] ?? '';
$orderby_text = $sortable[ $column_key ][3] ?? '';
$initial_order = $sortable[ $column_key ][4] ?? '';

/*
* We're in the initial view and there's no $_GET['orderby'] then check if the
Expand Down Expand Up @@ -1567,11 +1567,11 @@ public function print_table_description() {
foreach ( array_keys( $columns ) as $column_key ) {

if ( isset( $sortable[ $column_key ] ) ) {
$orderby = isset( $sortable[ $column_key ][0] ) ? $sortable[ $column_key ][0] : '';
$desc_first = isset( $sortable[ $column_key ][1] ) ? $sortable[ $column_key ][1] : false;
$abbr = isset( $sortable[ $column_key ][2] ) ? $sortable[ $column_key ][2] : '';
$orderby_text = isset( $sortable[ $column_key ][3] ) ? $sortable[ $column_key ][3] : '';
$initial_order = isset( $sortable[ $column_key ][4] ) ? $sortable[ $column_key ][4] : '';
$orderby = $sortable[ $column_key ][0] ?? '';
$desc_first = $sortable[ $column_key ][1] ?? false;
$abbr = $sortable[ $column_key ][2] ?? '';
$orderby_text = $sortable[ $column_key ][3] ?? '';
$initial_order = $sortable[ $column_key ][4] ?? '';

if ( ! is_string( $orderby_text ) || '' === $orderby_text ) {
return;
Expand Down
2 changes: 1 addition & 1 deletion src/wp-admin/includes/class-wp-media-list-table.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function __construct( $args = array() ) {
parent::__construct(
array(
'plural' => 'media',
'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
'screen' => $args['screen'] ?? null,
)
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/wp-admin/includes/class-wp-ms-sites-list-table.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function __construct( $args = array() ) {
parent::__construct(
array(
'plural' => 'sites',
'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
'screen' => $args['screen'] ?? null,
)
);
}
Expand Down Expand Up @@ -135,7 +135,7 @@ public function prepare_items() {
}
}

$order_by = isset( $_REQUEST['orderby'] ) ? $_REQUEST['orderby'] : '';
$order_by = $_REQUEST['orderby'] ?? '';
if ( 'registered' === $order_by ) {
// 'registered' is a valid field name.
} elseif ( 'lastupdated' === $order_by ) {
Expand Down
6 changes: 3 additions & 3 deletions src/wp-admin/includes/class-wp-ms-themes-list-table.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ public function __construct( $args = array() ) {
parent::__construct(
array(
'plural' => 'themes',
'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
'screen' => $args['screen'] ?? null,
)
);

$status = isset( $_REQUEST['theme_status'] ) ? $_REQUEST['theme_status'] : 'all';
$status = $_REQUEST['theme_status'] ?? 'all';
if ( ! in_array( $status, array( 'all', 'enabled', 'disabled', 'upgrade', 'search', 'broken', 'auto-update-enabled', 'auto-update-disabled' ), true ) ) {
$status = 'all';
}
Expand Down Expand Up @@ -153,7 +153,7 @@ public function prepare_items() {
$themes[ $filter ][ $key ] = $themes['all'][ $key ];

$theme_data = array(
'update_supported' => isset( $theme->update_supported ) ? $theme->update_supported : true,
'update_supported' => $theme->update_supported ?? true,
);

// Extra info if known. array_merge() ensures $theme_data has precedence if keys collide.
Expand Down
2 changes: 1 addition & 1 deletion src/wp-admin/includes/class-wp-ms-users-list-table.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function prepare_items() {

$users_per_page = $this->get_items_per_page( 'users_network_per_page' );

$role = isset( $_REQUEST['role'] ) ? $_REQUEST['role'] : '';
$role = $_REQUEST['role'] ?? '';

$paged = $this->get_pagenum();

Expand Down
4 changes: 2 additions & 2 deletions src/wp-admin/includes/class-wp-plugin-install-list-table.php
Original file line number Diff line number Diff line change
Expand Up @@ -556,8 +556,8 @@ public function display_rows() {
$author = ' <cite>' . sprintf( __( 'By %s' ), $author ) . '</cite>';
}

$requires_php = isset( $plugin['requires_php'] ) ? $plugin['requires_php'] : null;
$requires_wp = isset( $plugin['requires'] ) ? $plugin['requires'] : null;
$requires_php = $plugin['requires_php'] ?? null;
$requires_wp = $plugin['requires'] ?? null;

$compatible_php = is_php_version_compatible( $requires_php );
$compatible_wp = is_wp_version_compatible( $requires_wp );
Expand Down
Loading
Loading