requires_php ) ? $api->requires_php : null;
- $requires_wp = isset( $api->requires ) ? $api->requires : null;
+ $requires_php = $api->requires_php ?? null;
+ $requires_wp = $api->requires ?? null;
$compatible_php = is_php_version_compatible( $requires_php );
$compatible_wp = is_wp_version_compatible( $requires_wp );
diff --git a/src/wp-admin/includes/theme.php b/src/wp-admin/includes/theme.php
index 8fc9c00f149db..5220f98de9431 100644
--- a/src/wp-admin/includes/theme.php
+++ b/src/wp-admin/includes/theme.php
@@ -732,8 +732,8 @@ function wp_prepare_themes_for_js( $themes = null ) {
$customize_action = esc_url( $customize_action );
}
- $update_requires_wp = isset( $updates[ $slug ]['requires'] ) ? $updates[ $slug ]['requires'] : null;
- $update_requires_php = isset( $updates[ $slug ]['requires_php'] ) ? $updates[ $slug ]['requires_php'] : null;
+ $update_requires_wp = $updates[ $slug ]['requires'] ?? null;
+ $update_requires_php = $updates[ $slug ]['requires_php'] ?? null;
$auto_update = in_array( $slug, $auto_updates, true );
$auto_update_action = $auto_update ? 'disable-auto-update' : 'enable-auto-update';
diff --git a/src/wp-admin/includes/update-core.php b/src/wp-admin/includes/update-core.php
index 8c00c80da13f4..2f8045e8d193f 100644
--- a/src/wp-admin/includes/update-core.php
+++ b/src/wp-admin/includes/update-core.php
@@ -1238,7 +1238,7 @@ function update_core( $from, $to ) {
// Find the local version of the working directory.
$working_dir_local = WP_CONTENT_DIR . '/upgrade/' . basename( $from ) . $distro;
- $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 ) && isset( $checksums[ $wp_version ] ) ) {
$checksums = $checksums[ $wp_version ]; // Compat code for 3.7-beta2.
diff --git a/src/wp-admin/includes/update.php b/src/wp-admin/includes/update.php
index 33325236e3414..0fd9b3c79a5ff 100644
--- a/src/wp-admin/includes/update.php
+++ b/src/wp-admin/includes/update.php
@@ -470,7 +470,7 @@ function wp_plugin_update_row( $file, $plugin_data ) {
);
$plugin_name = wp_kses( $plugin_data['Name'], $plugins_allowedtags );
- $plugin_slug = isset( $response->slug ) ? $response->slug : $response->id;
+ $plugin_slug = $response->slug ?? $response->id;
if ( isset( $response->slug ) ) {
$details_url = self_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $plugin_slug . '§ion=changelog' );
@@ -504,7 +504,7 @@ function wp_plugin_update_row( $file, $plugin_data ) {
$active_class = is_plugin_active( $file ) ? ' active' : '';
}
- $requires_php = isset( $response->requires_php ) ? $response->requires_php : null;
+ $requires_php = $response->requires_php ?? null;
$compatible_php = is_php_version_compatible( $requires_php );
$notice_type = $compatible_php ? 'notice-warning' : 'notice-error';
@@ -696,8 +696,8 @@ function wp_theme_update_row( $theme_key, $theme ) {
$active = $theme->is_allowed( 'network' ) ? ' active' : '';
- $requires_wp = isset( $response['requires'] ) ? $response['requires'] : null;
- $requires_php = isset( $response['requires_php'] ) ? $response['requires_php'] : null;
+ $requires_wp = $response['requires'] ?? null;
+ $requires_php = $response['requires_php'] ?? null;
$compatible_wp = is_wp_version_compatible( $requires_wp );
$compatible_php = is_php_version_compatible( $requires_php );
diff --git a/src/wp-admin/link-parse-opml.php b/src/wp-admin/link-parse-opml.php
index 513ed074dc7a6..ba31fbef83430 100644
--- a/src/wp-admin/link-parse-opml.php
+++ b/src/wp-admin/link-parse-opml.php
@@ -55,9 +55,9 @@ function startElement( $parser, $tag_name, $attrs ) { // phpcs:ignore WordPress.
// Save the data away.
$names[] = $name;
$urls[] = $url;
- $targets[] = isset( $attrs['TARGET'] ) ? $attrs['TARGET'] : '';
- $feeds[] = isset( $attrs['XMLURL'] ) ? $attrs['XMLURL'] : '';
- $descriptions[] = isset( $attrs['DESCRIPTION'] ) ? $attrs['DESCRIPTION'] : '';
+ $targets[] = $attrs['TARGET'] ?? '';
+ $feeds[] = $attrs['XMLURL'] ?? '';
+ $descriptions[] = $attrs['DESCRIPTION'] ?? '';
} // End if outline.
}
diff --git a/src/wp-admin/nav-menus.php b/src/wp-admin/nav-menus.php
index 5b1a48c123ab2..f42f51e2666fe 100644
--- a/src/wp-admin/nav-menus.php
+++ b/src/wp-admin/nav-menus.php
@@ -52,7 +52,7 @@
$num_locations = count( array_keys( $locations ) );
// Allowed actions: add, update, delete.
-$action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : 'edit';
+$action = $_REQUEST['action'] ?? 'edit';
/*
* If a JSON blob of navigation menu data is found, expand it and inject it
diff --git a/src/wp-admin/options-privacy.php b/src/wp-admin/options-privacy.php
index 33e59b4601175..4205967acb3a8 100644
--- a/src/wp-admin/options-privacy.php
+++ b/src/wp-admin/options-privacy.php
@@ -30,7 +30,7 @@ static function ( $body_class ) {
}
);
-$action = isset( $_POST['action'] ) ? $_POST['action'] : '';
+$action = $_POST['action'] ?? '';
get_current_screen()->add_help_tab(
array(
diff --git a/src/wp-admin/update-core.php b/src/wp-admin/update-core.php
index 17094849a1dec..513aa1498ad61 100644
--- a/src/wp-admin/update-core.php
+++ b/src/wp-admin/update-core.php
@@ -542,7 +542,7 @@ function list_plugin_updates() {
}
}
- $requires_php = isset( $plugin_data->update->requires_php ) ? $plugin_data->update->requires_php : null;
+ $requires_php = $plugin_data->update->requires_php ?? null;
$compatible_php = is_php_version_compatible( $requires_php );
if ( ! $compatible_php && current_user_can( 'update_php' ) ) {
@@ -687,8 +687,8 @@ function list_theme_updates() {
}
foreach ( $themes as $stylesheet => $theme ) {
- $requires_wp = isset( $theme->update['requires'] ) ? $theme->update['requires'] : null;
- $requires_php = isset( $theme->update['requires_php'] ) ? $theme->update['requires_php'] : null;
+ $requires_wp = $theme->update['requires'] ?? null;
+ $requires_php = $theme->update['requires_php'] ?? null;
$compatible_wp = is_wp_version_compatible( $requires_wp );
$compatible_php = is_php_version_compatible( $requires_php );
@@ -854,8 +854,8 @@ function do_core_upgrade( $reinstall = false ) {
}
$url = wp_nonce_url( $url, 'upgrade-core' );
- $version = isset( $_POST['version'] ) ? $_POST['version'] : false;
- $locale = isset( $_POST['locale'] ) ? $_POST['locale'] : 'en_US';
+ $version = $_POST['version'] ?? false;
+ $locale = $_POST['locale'] ?? 'en_US';
$update = find_core_update( $version, $locale );
if ( ! $update ) {
return;
@@ -947,8 +947,8 @@ function do_core_upgrade( $reinstall = false ) {
* @since 2.7.0
*/
function do_dismiss_core_update() {
- $version = isset( $_POST['version'] ) ? $_POST['version'] : false;
- $locale = isset( $_POST['locale'] ) ? $_POST['locale'] : 'en_US';
+ $version = $_POST['version'] ?? false;
+ $locale = $_POST['locale'] ?? 'en_US';
$update = find_core_update( $version, $locale );
if ( ! $update ) {
return;
@@ -964,8 +964,8 @@ function do_dismiss_core_update() {
* @since 2.7.0
*/
function do_undismiss_core_update() {
- $version = isset( $_POST['version'] ) ? $_POST['version'] : false;
- $locale = isset( $_POST['locale'] ) ? $_POST['locale'] : 'en_US';
+ $version = $_POST['version'] ?? false;
+ $locale = $_POST['locale'] ?? 'en_US';
$update = find_core_update( $version, $locale );
if ( ! $update ) {
return;
@@ -975,7 +975,7 @@ function do_undismiss_core_update() {
exit;
}
-$action = isset( $_GET['action'] ) ? $_GET['action'] : 'upgrade-core';
+$action = $_GET['action'] ?? 'upgrade-core';
$upgrade_error = false;
if ( ( 'do-theme-upgrade' === $action || ( 'do-plugin-upgrade' === $action && ! isset( $_GET['plugins'] ) ) )
diff --git a/src/wp-admin/update.php b/src/wp-admin/update.php
index 090c37cfc4dfe..a6c59ec06dab2 100644
--- a/src/wp-admin/update.php
+++ b/src/wp-admin/update.php
@@ -22,7 +22,7 @@
if ( isset( $_GET['action'] ) ) {
$plugin = isset( $_REQUEST['plugin'] ) ? trim( $_REQUEST['plugin'] ) : '';
$theme = isset( $_REQUEST['theme'] ) ? urldecode( $_REQUEST['theme'] ) : '';
- $action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : '';
+ $action = $_REQUEST['action'] ?? '';
if ( 'update-selected' === $action ) {
if ( ! current_user_can( 'update_plugins' ) ) {
diff --git a/src/wp-admin/upload.php b/src/wp-admin/upload.php
index 7043dc279cf9c..1f42a287e4957 100644
--- a/src/wp-admin/upload.php
+++ b/src/wp-admin/upload.php
@@ -87,7 +87,7 @@
$message .= sprintf(
'
%2$s',
- esc_url( wp_nonce_url( 'upload.php?doaction=undo&action=untrash&ids=' . ( isset( $_GET['ids'] ) ? $_GET['ids'] : '' ), 'bulk-media' ) ),
+ esc_url( wp_nonce_url( 'upload.php?doaction=undo&action=untrash&ids=' . ( $_GET['ids'] ?? '' ), 'bulk-media' ) ),
__( 'Undo' )
);
@@ -117,7 +117,7 @@
$messages[3] = __( 'Error saving media file.' );
$messages[4] = __( 'Media file moved to the Trash.' ) . sprintf(
'
%2$s',
- esc_url( wp_nonce_url( 'upload.php?doaction=undo&action=untrash&ids=' . ( isset( $_GET['ids'] ) ? $_GET['ids'] : '' ), 'bulk-media' ) ),
+ esc_url( wp_nonce_url( 'upload.php?doaction=undo&action=untrash&ids=' . ( $_GET['ids'] ?? '' ), 'bulk-media' ) ),
__( 'Undo' )
);
$messages[5] = __( 'Media file restored from the Trash.' );
diff --git a/src/wp-includes/IXR/class-IXR-client.php b/src/wp-includes/IXR/class-IXR-client.php
index 2072f7c9c2deb..34c1f9337c461 100644
--- a/src/wp-includes/IXR/class-IXR-client.php
+++ b/src/wp-includes/IXR/class-IXR-client.php
@@ -31,8 +31,8 @@ function __construct( $server, $path = false, $port = 80, $timeout = 15 )
// Assume we have been given a URL instead
$bits = parse_url($server);
$this->server = $bits['host'];
- $this->port = isset($bits['port']) ? $bits['port'] : 80;
- $this->path = isset($bits['path']) ? $bits['path'] : '/';
+ $this->port = $bits['port'] ?? 80;
+ $this->path = $bits['path'] ?? '/';
// Make absolutely sure we have a path
if (!$this->path) {
diff --git a/src/wp-includes/author-template.php b/src/wp-includes/author-template.php
index 3de4432b5e4ca..3cd21248b70df 100644
--- a/src/wp-includes/author-template.php
+++ b/src/wp-includes/author-template.php
@@ -169,7 +169,7 @@ function get_the_author_meta( $field = '', $user_id = false ) {
if ( ! $user_id ) {
global $authordata;
- $user_id = isset( $authordata->ID ) ? $authordata->ID : 0;
+ $user_id = $authordata->ID ?? 0;
} else {
$authordata = get_userdata( $user_id );
}
@@ -178,7 +178,7 @@ function get_the_author_meta( $field = '', $user_id = false ) {
$field = 'user_' . $field;
}
- $value = isset( $authordata->$field ) ? $authordata->$field : '';
+ $value = $authordata->$field ?? '';
/**
* Filters the value of the requested user metadata.
@@ -502,7 +502,7 @@ function wp_list_authors( $args = '' ) {
}
foreach ( $authors as $author_id ) {
- $posts = isset( $post_counts[ $author_id ] ) ? $post_counts[ $author_id ] : 0;
+ $posts = $post_counts[ $author_id ] ?? 0;
if ( ! $posts && $parsed_args['hide_empty'] ) {
continue;
diff --git a/src/wp-includes/category-template.php b/src/wp-includes/category-template.php
index b2c88c9c25413..37427b25dde49 100644
--- a/src/wp-includes/category-template.php
+++ b/src/wp-includes/category-template.php
@@ -963,7 +963,7 @@ function wp_generate_tag_cloud( $tags, $args = '' ) {
// Assemble the data that will be used to generate the tag cloud markup.
$tags_data = array();
foreach ( $tags as $key => $tag ) {
- $tag_id = isset( $tag->id ) ? $tag->id : $key;
+ $tag_id = $tag->id ?? $key;
$count = $counts[ $key ];
$real_count = $real_counts[ $key ];
diff --git a/src/wp-includes/class-wp-duotone.php b/src/wp-includes/class-wp-duotone.php
index 7c7416b4399bc..69b56e090c5d4 100644
--- a/src/wp-includes/class-wp-duotone.php
+++ b/src/wp-includes/class-wp-duotone.php
@@ -209,7 +209,7 @@ private static function colord_parse_hue( $value, $unit = 'deg' ) {
'rad' => 360 / ( M_PI * 2 ),
);
- $factor = isset( $angle_units[ $unit ] ) ? $angle_units[ $unit ] : 1;
+ $factor = $angle_units[ $unit ] ?? 1;
return (float) $value * $factor;
}
@@ -972,9 +972,7 @@ private static function get_selector( $block_type ) {
* If the experimental duotone support was set, that value is to be
* treated as a selector and requires scoping.
*/
- $experimental_duotone = isset( $block_type->supports['color']['__experimentalDuotone'] )
- ? $block_type->supports['color']['__experimentalDuotone']
- : false;
+ $experimental_duotone = $block_type->supports['color']['__experimentalDuotone'] ?? false;
if ( $experimental_duotone ) {
$root_selector = wp_get_block_css_selector( $block_type );
return is_string( $experimental_duotone )
@@ -1003,7 +1001,7 @@ private static function get_all_global_styles_presets() {
}
// Get the per block settings from the theme.json.
$tree = wp_get_global_settings();
- $presets_by_origin = isset( $tree['color']['duotone'] ) ? $tree['color']['duotone'] : array();
+ $presets_by_origin = $tree['color']['duotone'] ?? array();
self::$global_styles_presets = array();
foreach ( $presets_by_origin as $presets ) {
@@ -1304,9 +1302,7 @@ public static function add_editor_settings( $settings ) {
* @return array Filtered block type settings.
*/
public static function migrate_experimental_duotone_support_flag( $settings, $metadata ) {
- $duotone_support = isset( $metadata['supports']['color']['__experimentalDuotone'] )
- ? $metadata['supports']['color']['__experimentalDuotone']
- : null;
+ $duotone_support = $metadata['supports']['color']['__experimentalDuotone'] ?? null;
if ( ! isset( $settings['supports']['filter']['duotone'] ) && null !== $duotone_support ) {
_wp_array_set( $settings, array( 'supports', 'filter', 'duotone' ), (bool) $duotone_support );
diff --git a/src/wp-includes/class-wp-hook.php b/src/wp-includes/class-wp-hook.php
index 0740d52ac1f45..cd6860c0f81f2 100644
--- a/src/wp-includes/class-wp-hook.php
+++ b/src/wp-includes/class-wp-hook.php
@@ -492,7 +492,7 @@ public function offsetExists( $offset ) {
*/
#[ReturnTypeWillChange]
public function offsetGet( $offset ) {
- return isset( $this->callbacks[ $offset ] ) ? $this->callbacks[ $offset ] : null;
+ return $this->callbacks[ $offset ] ?? null;
}
/**
diff --git a/src/wp-includes/class-wp-theme.php b/src/wp-includes/class-wp-theme.php
index 613011ec3cd80..a6966351f185f 100644
--- a/src/wp-includes/class-wp-theme.php
+++ b/src/wp-includes/class-wp-theme.php
@@ -515,7 +515,7 @@ public function __construct( $theme_dir, $theme_root, $_child = null ) {
return;
}
// Set the parent. Pass the current instance so we can do the checks above and assess errors.
- $this->parent = new WP_Theme( $this->template, isset( $theme_root_template ) ? $theme_root_template : $this->theme_root, $this );
+ $this->parent = new WP_Theme( $this->template, $theme_root_template ?? $this->theme_root, $this );
}
if ( wp_paused_themes()->get( $this->stylesheet ) && ( ! is_wp_error( $this->errors ) || ! isset( $this->errors->errors['theme_paused'] ) ) ) {
@@ -776,7 +776,7 @@ public function exists() {
* @return WP_Theme|false Parent theme, or false if the active theme is not a child theme.
*/
public function parent() {
- return isset( $this->parent ) ? $this->parent : false;
+ return $this->parent ?? false;
}
/**
@@ -1397,7 +1397,7 @@ public function get_page_templates( $post = null, $post_type = 'page' ) {
}
$post_templates = $this->get_post_templates();
- $post_templates = isset( $post_templates[ $post_type ] ) ? $post_templates[ $post_type ] : array();
+ $post_templates = $post_templates[ $post_type ] ?? array();
/**
* Filters list of page templates for a theme.
diff --git a/src/wp-includes/class-wp-xmlrpc-server.php b/src/wp-includes/class-wp-xmlrpc-server.php
index 7c1e101e1e091..0ae193ed54d96 100644
--- a/src/wp-includes/class-wp-xmlrpc-server.php
+++ b/src/wp-includes/class-wp-xmlrpc-server.php
@@ -1680,7 +1680,7 @@ protected function _insert_post( $user, $content_struct ) {
}
// Handle enclosures.
- $enclosure = isset( $post_data['enclosure'] ) ? $post_data['enclosure'] : null;
+ $enclosure = $post_data['enclosure'] ?? null;
$this->add_enclosure_if_new( $post_id, $enclosure );
$this->attach_uploads( $post_id, $post_data['post_content'] );
@@ -1986,7 +1986,7 @@ public function wp_getPosts( $args ) {
$username = $args[1];
$password = $args[2];
- $filter = isset( $args[3] ) ? $args[3] : array();
+ $filter = $args[3] ?? array();
if ( isset( $args[4] ) ) {
$fields = $args[4];
@@ -2457,7 +2457,7 @@ public function wp_getTerms( $args ) {
$username = $args[1];
$password = $args[2];
$taxonomy = $args[3];
- $filter = isset( $args[4] ) ? $args[4] : array();
+ $filter = $args[4] ?? array();
$user = $this->login( $username, $password );
if ( ! $user ) {
@@ -2615,7 +2615,7 @@ public function wp_getTaxonomies( $args ) {
$username = $args[1];
$password = $args[2];
- $filter = isset( $args[3] ) ? $args[3] : array( 'public' => true );
+ $filter = $args[3] ?? array( 'public' => true );
if ( isset( $args[4] ) ) {
$fields = $args[4];
@@ -2764,7 +2764,7 @@ public function wp_getUsers( $args ) {
$username = $args[1];
$password = $args[2];
- $filter = isset( $args[3] ) ? $args[3] : array();
+ $filter = $args[3] ?? array();
if ( isset( $args[4] ) ) {
$fields = $args[4];
@@ -3658,7 +3658,7 @@ public function wp_getComments( $args ) {
$username = $args[1];
$password = $args[2];
- $struct = isset( $args[3] ) ? $args[3] : array();
+ $struct = $args[3] ?? array();
$user = $this->login( $username, $password );
if ( ! $user ) {
@@ -4433,7 +4433,7 @@ public function wp_getMediaLibrary( $args ) {
$username = $args[1];
$password = $args[2];
- $struct = isset( $args[3] ) ? $args[3] : array();
+ $struct = $args[3] ?? array();
$user = $this->login( $username, $password );
if ( ! $user ) {
@@ -4624,7 +4624,7 @@ public function wp_getPostTypes( $args ) {
$username = $args[1];
$password = $args[2];
- $filter = isset( $args[3] ) ? $args[3] : array( 'public' => true );
+ $filter = $args[3] ?? array( 'public' => true );
if ( isset( $args[4] ) ) {
$fields = $args[4];
@@ -5375,7 +5375,7 @@ public function mw_newPost( $args ) {
$username = $args[1];
$password = $args[2];
$content_struct = $args[3];
- $publish = isset( $args[4] ) ? $args[4] : 0;
+ $publish = $args[4] ?? 0;
$user = $this->login( $username, $password );
if ( ! $user ) {
@@ -5491,8 +5491,8 @@ public function mw_newPost( $args ) {
$post_author = $content_struct['wp_author_id'];
}
- $post_title = isset( $content_struct['title'] ) ? $content_struct['title'] : '';
- $post_content = isset( $content_struct['description'] ) ? $content_struct['description'] : '';
+ $post_title = $content_struct['title'] ?? '';
+ $post_content = $content_struct['description'] ?? '';
$post_status = $publish ? 'publish' : 'draft';
@@ -5510,10 +5510,10 @@ public function mw_newPost( $args ) {
}
}
- $post_excerpt = isset( $content_struct['mt_excerpt'] ) ? $content_struct['mt_excerpt'] : '';
- $post_more = isset( $content_struct['mt_text_more'] ) ? $content_struct['mt_text_more'] : '';
+ $post_excerpt = $content_struct['mt_excerpt'] ?? '';
+ $post_more = $content_struct['mt_text_more'] ?? '';
- $tags_input = isset( $content_struct['mt_keywords'] ) ? $content_struct['mt_keywords'] : array();
+ $tags_input = $content_struct['mt_keywords'] ?? array();
if ( isset( $content_struct['mt_allow_comments'] ) ) {
if ( ! is_numeric( $content_struct['mt_allow_comments'] ) ) {
@@ -5661,7 +5661,7 @@ public function mw_newPost( $args ) {
}
// Handle enclosures.
- $enclosure = isset( $content_struct['enclosure'] ) ? $content_struct['enclosure'] : null;
+ $enclosure = $content_struct['enclosure'] ?? null;
$this->add_enclosure_if_new( $post_id, $enclosure );
$this->attach_uploads( $post_id, $post_content );
@@ -5771,7 +5771,7 @@ public function mw_editPost( $args ) {
$username = $args[1];
$password = $args[2];
$content_struct = $args[3];
- $publish = isset( $args[4] ) ? $args[4] : 0;
+ $publish = $args[4] ?? 0;
$user = $this->login( $username, $password );
if ( ! $user ) {
@@ -5955,7 +5955,7 @@ public function mw_editPost( $args ) {
$post_excerpt = $content_struct['mt_excerpt'];
}
- $post_more = isset( $content_struct['mt_text_more'] ) ? $content_struct['mt_text_more'] : '';
+ $post_more = $content_struct['mt_text_more'] ?? '';
$post_status = $publish ? 'publish' : 'draft';
if ( isset( $content_struct[ "{$post_type}_status" ] ) ) {
@@ -5972,7 +5972,7 @@ public function mw_editPost( $args ) {
}
}
- $tags_input = isset( $content_struct['mt_keywords'] ) ? $content_struct['mt_keywords'] : array();
+ $tags_input = $content_struct['mt_keywords'] ?? array();
if ( 'publish' === $post_status || 'private' === $post_status ) {
if ( 'page' === $post_type && ! current_user_can( 'publish_pages' ) ) {
@@ -6080,7 +6080,7 @@ public function mw_editPost( $args ) {
}
// Handle enclosures.
- $enclosure = isset( $content_struct['enclosure'] ) ? $content_struct['enclosure'] : null;
+ $enclosure = $content_struct['enclosure'] ?? null;
$this->add_enclosure_if_new( $post_id, $enclosure );
$this->attach_uploads( $post_id, $post_content );
@@ -7059,7 +7059,7 @@ public function pingback_ping( $args ) {
$remote_source = preg_replace( '/<\/*(h1|h2|h3|h4|h5|h6|p|th|td|li|dt|dd|pre|caption|input|textarea|button|body)[^>]*>/', "\n\n", $remote_source );
preg_match( '|
([^<]*?)|is', $remote_source, $matchtitle );
- $title = isset( $matchtitle[1] ) ? $matchtitle[1] : '';
+ $title = $matchtitle[1] ?? '';
if ( empty( $title ) ) {
return $this->pingback_error( 32, __( 'A title on that page cannot be found.' ) );
}
diff --git a/src/wp-includes/deprecated.php b/src/wp-includes/deprecated.php
index 0b721715120de..19ccaf7e6dbd4 100644
--- a/src/wp-includes/deprecated.php
+++ b/src/wp-includes/deprecated.php
@@ -4264,9 +4264,7 @@ function wp_render_duotone_filter_preset( $preset ) {
function wp_skip_border_serialization( $block_type ) {
_deprecated_function( __FUNCTION__, '6.0.0', 'wp_should_skip_block_supports_serialization()' );
- $border_support = isset( $block_type->supports['__experimentalBorder'] )
- ? $block_type->supports['__experimentalBorder']
- : false;
+ $border_support = $block_type->supports['__experimentalBorder'] ?? false;
return is_array( $border_support ) &&
array_key_exists( '__experimentalSkipSerialization', $border_support ) &&
@@ -4288,9 +4286,7 @@ function wp_skip_border_serialization( $block_type ) {
function wp_skip_dimensions_serialization( $block_type ) {
_deprecated_function( __FUNCTION__, '6.0.0', 'wp_should_skip_block_supports_serialization()' );
- $dimensions_support = isset( $block_type->supports['__experimentalDimensions'] )
- ? $block_type->supports['__experimentalDimensions']
- : false;
+ $dimensions_support = $block_type->supports['__experimentalDimensions'] ?? false;
return is_array( $dimensions_support ) &&
array_key_exists( '__experimentalSkipSerialization', $dimensions_support ) &&
@@ -4312,9 +4308,7 @@ function wp_skip_dimensions_serialization( $block_type ) {
function wp_skip_spacing_serialization( $block_type ) {
_deprecated_function( __FUNCTION__, '6.0.0', 'wp_should_skip_block_supports_serialization()' );
- $spacing_support = isset( $block_type->supports['spacing'] )
- ? $block_type->supports['spacing']
- : false;
+ $spacing_support = $block_type->supports['spacing'] ?? false;
return is_array( $spacing_support ) &&
array_key_exists( '__experimentalSkipSerialization', $spacing_support ) &&
diff --git a/src/wp-includes/embed.php b/src/wp-includes/embed.php
index b7567024aa194..c90d044a81915 100644
--- a/src/wp-includes/embed.php
+++ b/src/wp-includes/embed.php
@@ -693,7 +693,7 @@ function get_oembed_response_data_for_url( $url, $args ) {
return false;
}
- $width = isset( $args['width'] ) ? $args['width'] : 0;
+ $width = $args['width'] ?? 0;
$data = get_oembed_response_data( $post_id, $width );
diff --git a/src/wp-includes/general-template.php b/src/wp-includes/general-template.php
index df18cc9731fa5..ac5427e2ce7f6 100644
--- a/src/wp-includes/general-template.php
+++ b/src/wp-includes/general-template.php
@@ -4658,7 +4658,7 @@ function paginate_links( $args = '' ) {
$url_parts = explode( '?', $pagenum_link );
// Get max pages and current page out of the current query, if available.
- $total = isset( $wp_query->max_num_pages ) ? $wp_query->max_num_pages : 1;
+ $total = $wp_query->max_num_pages ?? 1;
$current = get_query_var( 'paged' ) ? (int) get_query_var( 'paged' ) : 1;
// Append the format placeholder to the base URL.
@@ -4697,7 +4697,7 @@ function paginate_links( $args = '' ) {
if ( isset( $url_parts[1] ) ) {
// Find the format argument.
$format = explode( '?', str_replace( '%_%', $args['format'], $args['base'] ) );
- $format_query = isset( $format[1] ) ? $format[1] : '';
+ $format_query = $format[1] ?? '';
wp_parse_str( $format_query, $format_args );
// Find the query args of the requested URL.
diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php
index f43ebc36eab64..f35da615b5344 100644
--- a/src/wp-includes/media.php
+++ b/src/wp-includes/media.php
@@ -1229,7 +1229,7 @@ function wp_get_attachment_image( $attachment_id, $size = 'thumbnail', $icon = f
*/
function wp_get_attachment_image_url( $attachment_id, $size = 'thumbnail', $icon = false ) {
$image = wp_get_attachment_image_src( $attachment_id, $size, $icon );
- return isset( $image[0] ) ? $image[0] : false;
+ return $image[0] ?? false;
}
/**
@@ -1410,7 +1410,7 @@ function wp_calculate_image_srcset( $size_array, $image_src, $image_meta, $attac
* be compared against the image URL using the same port.
*/
$parsed = parse_url( $image_baseurl );
- $domain = isset( $parsed['host'] ) ? $parsed['host'] : '';
+ $domain = $parsed['host'] ?? '';
if ( isset( $parsed['port'] ) ) {
$domain .= ':' . $parsed['port'];
@@ -2171,7 +2171,7 @@ function wp_img_tag_add_loading_optimization_attrs( $image, $context ) {
*/
$filtered_decoding_attr = apply_filters(
'wp_img_tag_add_decoding_attr',
- isset( $optimization_attrs['decoding'] ) ? $optimization_attrs['decoding'] : false,
+ $optimization_attrs['decoding'] ?? false,
$image,
$context
);
@@ -2213,7 +2213,7 @@ function wp_img_tag_add_loading_optimization_attrs( $image, $context ) {
*/
$filtered_loading_attr = apply_filters(
'wp_img_tag_add_loading_attr',
- isset( $optimization_attrs['loading'] ) ? $optimization_attrs['loading'] : false,
+ $optimization_attrs['loading'] ?? false,
$image,
$context
);
@@ -2232,7 +2232,7 @@ function wp_img_tag_add_loading_optimization_attrs( $image, $context ) {
* is only intended for the specific scenario where the above filtered caused the problem.
*/
if ( isset( $optimization_attrs['fetchpriority'] ) && 'high' === $optimization_attrs['fetchpriority'] &&
- ( isset( $optimization_attrs['loading'] ) ? $optimization_attrs['loading'] : false ) !== $filtered_loading_attr &&
+ ( $optimization_attrs['loading'] ?? false ) !== $filtered_loading_attr &&
'lazy' === $filtered_loading_attr
) {
_doing_it_wrong(
@@ -2380,7 +2380,7 @@ function wp_iframe_tag_add_loading_attr( $iframe, $context ) {
return $iframe;
}
- $value = isset( $optimization_attrs['loading'] ) ? $optimization_attrs['loading'] : false;
+ $value = $optimization_attrs['loading'] ?? false;
/**
* Filters the `loading` attribute value to add to an iframe. Default 'lazy'.
diff --git a/src/wp-includes/nav-menu.php b/src/wp-includes/nav-menu.php
index d808c4e212d39..aefc006cd6493 100644
--- a/src/wp-includes/nav-menu.php
+++ b/src/wp-includes/nav-menu.php
@@ -319,8 +319,8 @@ function wp_update_nav_menu_object( $menu_id = 0, $menu_data = array() ) {
$_menu = wp_get_nav_menu_object( $menu_id );
$args = array(
- 'description' => ( isset( $menu_data['description'] ) ? $menu_data['description'] : '' ),
- 'name' => ( isset( $menu_data['menu-name'] ) ? $menu_data['menu-name'] : '' ),
+ 'description' => ( $menu_data['description'] ?? '' ),
+ 'name' => ( $menu_data['menu-name'] ?? '' ),
'parent' => ( isset( $menu_data['parent'] ) ? (int) $menu_data['parent'] : 0 ),
'slug' => null,
);
diff --git a/src/wp-includes/pluggable.php b/src/wp-includes/pluggable.php
index 99c23540d8983..4241a8f184461 100644
--- a/src/wp-includes/pluggable.php
+++ b/src/wp-includes/pluggable.php
@@ -1722,7 +1722,7 @@ function wp_validate_redirect( $location, $fallback_url = '' ) {
* @param string[] $hosts An array of allowed host names.
* @param string $host The host name of the redirect destination; empty string if not set.
*/
- $allowed_hosts = (array) apply_filters( 'allowed_redirect_hosts', array( $wpp['host'] ), isset( $lp['host'] ) ? $lp['host'] : '' );
+ $allowed_hosts = (array) apply_filters( 'allowed_redirect_hosts', array( $wpp['host'] ), $lp['host'] ?? '' );
if ( isset( $lp['host'] ) && ( ! in_array( $lp['host'], $allowed_hosts, true ) && strtolower( $wpp['host'] ) !== $lp['host'] ) ) {
$location = $fallback_url;
diff --git a/src/wp-includes/theme.php b/src/wp-includes/theme.php
index e22e3c236f859..49779728414c7 100644
--- a/src/wp-includes/theme.php
+++ b/src/wp-includes/theme.php
@@ -1104,7 +1104,7 @@ function get_theme_mod( $name, $default_value = false ) {
*/
function set_theme_mod( $name, $value ) {
$mods = get_theme_mods();
- $old_value = isset( $mods[ $name ] ) ? $mods[ $name ] : false;
+ $old_value = $mods[ $name ] ?? false;
/**
* Filters the theme modification, or 'theme_mod', value on save.
@@ -3428,7 +3428,7 @@ function get_registered_theme_feature( $feature ) {
return null;
}
- return isset( $_wp_registered_theme_features[ $feature ] ) ? $_wp_registered_theme_features[ $feature ] : null;
+ return $_wp_registered_theme_features[ $feature ] ?? null;
}
/**
diff --git a/src/wp-includes/update.php b/src/wp-includes/update.php
index 4ab8f5a4e4498..b7bf5a03780e7 100644
--- a/src/wp-includes/update.php
+++ b/src/wp-includes/update.php
@@ -101,7 +101,7 @@ function wp_version_check( $extra_stats = array(), $force_check = false ) {
'php' => $php_version,
'locale' => $locale,
'mysql' => $mysql_version,
- 'local_package' => isset( $wp_local_package ) ? $wp_local_package : '',
+ 'local_package' => $wp_local_package ?? '',
'blogs' => $num_blogs,
'users' => get_user_count(),
'multisite_enabled' => $multisite_enabled,
@@ -579,7 +579,7 @@ function wp_update_plugins( $extra_stats = array() ) {
foreach ( $update->translations as $translation ) {
if ( isset( $translation['language'], $translation['package'] ) ) {
$translation['type'] = 'plugin';
- $translation['slug'] = isset( $update->slug ) ? $update->slug : $update->id;
+ $translation['slug'] = $update->slug ?? $update->id;
$updates->translations[] = $translation;
}
@@ -856,7 +856,7 @@ function wp_update_themes( $extra_stats = array() ) {
foreach ( $update->translations as $translation ) {
if ( isset( $translation['language'], $translation['package'] ) ) {
$translation['type'] = 'theme';
- $translation['slug'] = isset( $update->theme ) ? $update->theme : $update->id;
+ $translation['slug'] = $update->theme ?? $update->id;
$new_update->translations[] = $translation;
}