@@ -1808,7 +1808,7 @@ function wp_ajax_closed_postboxes() {
18081808 $ hidden = isset ( $ _POST ['hidden ' ] ) ? explode ( ', ' , $ _POST ['hidden ' ] ) : array ();
18091809 $ hidden = array_filter ( $ hidden );
18101810
1811- $ page = isset ( $ _POST ['page ' ] ) ? $ _POST [ ' page ' ] : '' ;
1811+ $ page = $ _POST ['page ' ] ?? '' ;
18121812
18131813 if ( sanitize_key ( $ page ) !== $ page ) {
18141814 wp_die ( 0 );
@@ -1839,7 +1839,7 @@ function wp_ajax_closed_postboxes() {
18391839 */
18401840function wp_ajax_hidden_columns () {
18411841 check_ajax_referer ( 'screen-options-nonce ' , 'screenoptionnonce ' );
1842- $ page = isset ( $ _POST ['page ' ] ) ? $ _POST [ ' page ' ] : '' ;
1842+ $ page = $ _POST ['page ' ] ?? '' ;
18431843
18441844 if ( sanitize_key ( $ page ) !== $ page ) {
18451845 wp_die ( 0 );
@@ -1988,13 +1988,13 @@ function wp_ajax_menu_locations_save() {
19881988function wp_ajax_meta_box_order () {
19891989 check_ajax_referer ( 'meta-box-order ' );
19901990 $ order = isset ( $ _POST ['order ' ] ) ? (array ) $ _POST ['order ' ] : false ;
1991- $ page_columns = isset ( $ _POST ['page_columns ' ] ) ? $ _POST [ ' page_columns ' ] : 'auto ' ;
1991+ $ page_columns = $ _POST ['page_columns ' ] ?? 'auto ' ;
19921992
19931993 if ( 'auto ' !== $ page_columns ) {
19941994 $ page_columns = (int ) $ page_columns ;
19951995 }
19961996
1997- $ page = isset ( $ _POST ['page ' ] ) ? $ _POST [ ' page ' ] : '' ;
1997+ $ page = $ _POST ['page ' ] ?? '' ;
19981998
19991999 if ( sanitize_key ( $ page ) !== $ page ) {
20002000 wp_die ( 0 );
@@ -2052,8 +2052,8 @@ function wp_ajax_get_permalink() {
20522052function wp_ajax_sample_permalink () {
20532053 check_ajax_referer ( 'samplepermalink ' , 'samplepermalinknonce ' );
20542054 $ post_id = isset ( $ _POST ['post_id ' ] ) ? (int ) $ _POST ['post_id ' ] : 0 ;
2055- $ title = isset ( $ _POST ['new_title ' ] ) ? $ _POST [ ' new_title ' ] : '' ;
2056- $ slug = isset ( $ _POST ['new_slug ' ] ) ? $ _POST [ ' new_slug ' ] : null ;
2055+ $ title = $ _POST ['new_title ' ] ?? '' ;
2056+ $ slug = $ _POST ['new_slug ' ] ?? null ;
20572057 wp_die ( get_sample_permalink_html ( $ post_id , $ title , $ slug ) );
20582058}
20592059
@@ -2393,7 +2393,7 @@ function wp_ajax_save_widget() {
23932393 $ error = '<p> ' . __ ( 'An error has occurred. Please reload the page and try again. ' ) . '</p> ' ;
23942394
23952395 $ sidebars = wp_get_sidebars_widgets ();
2396- $ sidebar = isset ( $ sidebars [ $ sidebar_id ] ) ? $ sidebars [ $ sidebar_id ] : array ();
2396+ $ sidebar = $ sidebars [ $ sidebar_id ] ?? array ();
23972397
23982398 // Delete.
23992399 if ( isset ( $ _POST ['delete_widget ' ] ) && $ _POST ['delete_widget ' ] ) {
@@ -3353,12 +3353,12 @@ function wp_ajax_send_attachment_to_editor() {
33533353 remove_filter ( 'media_send_to_editor ' , 'image_media_send_to_editor ' );
33543354
33553355 if ( str_starts_with ( $ post ->post_mime_type , 'image ' ) ) {
3356- $ align = isset ( $ attachment ['align ' ] ) ? $ attachment [ ' align ' ] : 'none ' ;
3357- $ size = isset ( $ attachment ['image-size ' ] ) ? $ attachment [ ' image-size ' ] : 'medium ' ;
3358- $ alt = isset ( $ attachment ['image_alt ' ] ) ? $ attachment [ ' image_alt ' ] : '' ;
3356+ $ align = $ attachment ['align ' ] ?? 'none ' ;
3357+ $ size = $ attachment ['image-size ' ] ?? 'medium ' ;
3358+ $ alt = $ attachment ['image_alt ' ] ?? '' ;
33593359
33603360 // No whitespace-only captions.
3361- $ caption = isset ( $ attachment ['post_excerpt ' ] ) ? $ attachment [ ' post_excerpt ' ] : '' ;
3361+ $ caption = $ attachment ['post_excerpt ' ] ?? '' ;
33623362 if ( '' === trim ( $ caption ) ) {
33633363 $ caption = '' ;
33643364 }
@@ -3368,7 +3368,7 @@ function wp_ajax_send_attachment_to_editor() {
33683368 } elseif ( wp_attachment_is ( 'video ' , $ post ) || wp_attachment_is ( 'audio ' , $ post ) ) {
33693369 $ html = stripslashes_deep ( $ _POST ['html ' ] );
33703370 } else {
3371- $ html = isset ( $ attachment ['post_title ' ] ) ? $ attachment [ ' post_title ' ] : '' ;
3371+ $ html = $ attachment ['post_title ' ] ?? '' ;
33723372 $ rel = $ rel ? ' rel="attachment wp-att- ' . $ id . '" ' : '' ; // Hard-coded string, $id is already sanitized.
33733373
33743374 if ( ! empty ( $ url ) ) {
@@ -3421,7 +3421,7 @@ function wp_ajax_send_link_to_editor() {
34213421 $ link_text = wp_basename ( $ src );
34223422 }
34233423
3424- $ post = get_post ( isset ( $ _POST ['post_id ' ] ) ? $ _POST [ ' post_id ' ] : 0 );
3424+ $ post = get_post ( $ _POST ['post_id ' ] ?? 0 );
34253425
34263426 // Ping WordPress for an embed.
34273427 $ check_embed = $ wp_embed ->run_shortcode ( '[embed] ' . $ src . '[/embed] ' );
@@ -3647,7 +3647,7 @@ function wp_ajax_query_themes() {
36473647 }
36483648 }
36493649
3650- $ old_filter = isset ( $ args ['browse ' ] ) ? $ args [ ' browse ' ] : 'search ' ;
3650+ $ old_filter = $ args ['browse ' ] ?? 'search ' ;
36513651
36523652 /** This filter is documented in wp-admin/includes/class-wp-theme-install-list-table.php */
36533653 $ args = apply_filters ( 'install_themes_table_api_args_ ' . $ old_filter , $ args );
0 commit comments