diff --git a/wp-admin/includes/class-walker-category-checklist.php b/wp-admin/includes/class-walker-category-checklist.php
index 3647d8770b..f4d3fbed36 100644
--- a/wp-admin/includes/class-walker-category-checklist.php
+++ b/wp-admin/includes/class-walker-category-checklist.php
@@ -83,7 +83,7 @@ class Walker_Category_Checklist extends Walker {
$args['popular_cats'] = empty( $args['popular_cats'] ) ? array() : $args['popular_cats'];
- $class = in_array( $category->term_id, $args['popular_cats'] ) ? ' class="popular-category"' : '';
+ $class = in_array( $category->term_id, $args['popular_cats'], true ) ? ' class="popular-category"' : '';
$args['selected_cats'] = empty( $args['selected_cats'] ) ? array() : $args['selected_cats'];
@@ -91,7 +91,7 @@ class Walker_Category_Checklist extends Walker {
$aria_checked = 'false';
$inner_class = 'category';
- if ( in_array( $category->term_id, $args['selected_cats'] ) ) {
+ if ( in_array( $category->term_id, $args['selected_cats'], true ) ) {
$inner_class .= ' selected';
$aria_checked = 'true';
}
@@ -102,10 +102,13 @@ class Walker_Category_Checklist extends Walker {
/** This filter is documented in wp-includes/category-template.php */
esc_html( apply_filters( 'the_category', $category->name, '', '' ) ) . '';
} else {
+ $is_selected = in_array( $category->term_id, $args['selected_cats'], true );
+ $is_disabled = ! empty( $args['disabled'] );
+
$output .= "\n
" .
'';
}
diff --git a/wp-admin/includes/class-wp-filesystem-base.php b/wp-admin/includes/class-wp-filesystem-base.php
index d9459b31df..fe96929b5c 100644
--- a/wp-admin/includes/class-wp-filesystem-base.php
+++ b/wp-admin/includes/class-wp-filesystem-base.php
@@ -401,7 +401,7 @@ class WP_Filesystem_Base {
$attarray = preg_split( '//', $mode );
for ( $i = 0, $c = count( $attarray ); $i < $c; $i++ ) {
- $key = array_search( $attarray[ $i ], $legal );
+ $key = array_search( $attarray[ $i ], $legal, true );
if ( $key ) {
$realmode .= $legal[ $key ];
}
diff --git a/wp-admin/includes/class-wp-ms-users-list-table.php b/wp-admin/includes/class-wp-ms-users-list-table.php
index 4f2932acdc..57968ae935 100644
--- a/wp-admin/includes/class-wp-ms-users-list-table.php
+++ b/wp-admin/includes/class-wp-ms-users-list-table.php
@@ -505,7 +505,7 @@ class WP_MS_Users_List_Table extends WP_List_Table {
$actions['edit'] = '' . __( 'Edit' ) . '';
}
- if ( current_user_can( 'delete_user', $user->ID ) && ! in_array( $user->user_login, $super_admins ) ) {
+ if ( current_user_can( 'delete_user', $user->ID ) && ! in_array( $user->user_login, $super_admins, true ) ) {
$actions['delete'] = '' . __( 'Delete' ) . '';
}
diff --git a/wp-admin/includes/class-wp-terms-list-table.php b/wp-admin/includes/class-wp-terms-list-table.php
index 03b997a443..2d9aca5932 100644
--- a/wp-admin/includes/class-wp-terms-list-table.php
+++ b/wp-admin/includes/class-wp-terms-list-table.php
@@ -300,7 +300,7 @@ class WP_Terms_List_Table extends WP_List_Table {
$my_parent = get_term( $p, $taxonomy );
$my_parents[] = $my_parent;
$p = $my_parent->parent;
- if ( in_array( $p, $parent_ids ) ) { // Prevent parent loops.
+ if ( in_array( $p, $parent_ids, true ) ) { // Prevent parent loops.
break;
}
$parent_ids[] = $p;
diff --git a/wp-admin/includes/dashboard.php b/wp-admin/includes/dashboard.php
index 2a31c6c0b3..11fb18268c 100644
--- a/wp-admin/includes/dashboard.php
+++ b/wp-admin/includes/dashboard.php
@@ -519,7 +519,7 @@ function wp_dashboard_quick_press( $error_msg = false ) {
$post = get_default_post_to_edit( 'post', true );
$user_id = get_current_user_id();
// Don't create an option if this is a super admin who does not belong to this site.
- if ( in_array( get_current_blog_id(), array_keys( get_blogs_of_user( $user_id ) ) ) ) {
+ if ( in_array( get_current_blog_id(), array_keys( get_blogs_of_user( $user_id ) ), true ) ) {
update_user_option( $user_id, 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID.
}
}
diff --git a/wp-admin/includes/ms.php b/wp-admin/includes/ms.php
index f1567cb5d4..f683c737ef 100644
--- a/wp-admin/includes/ms.php
+++ b/wp-admin/includes/ms.php
@@ -922,19 +922,23 @@ function confirm_delete_users( $users ) {
'fields' => array( 'ID', 'user_login' ),
)
);
+
if ( is_array( $blog_users ) && ! empty( $blog_users ) ) {
$user_site = "{$details->blogname}";
$user_dropdown = '';
$user_dropdown .= "\n";
?>
diff --git a/wp-admin/includes/nav-menu.php b/wp-admin/includes/nav-menu.php
index e3d1053f77..64dda1db61 100644
--- a/wp-admin/includes/nav-menu.php
+++ b/wp-admin/includes/nav-menu.php
@@ -1149,8 +1149,10 @@ function wp_nav_menu_update_menu_items( $nav_menu_selected_id, $nav_menu_selecte
'post_status' => 'draft,publish',
)
);
- $messages = array();
- $menu_items = array();
+
+ $messages = array();
+ $menu_items = array();
+
// Index menu items by DB ID.
foreach ( $unsorted_menu_items as $_item ) {
$menu_items[ $_item->db_id ] = $_item;
@@ -1173,6 +1175,7 @@ function wp_nav_menu_update_menu_items( $nav_menu_selected_id, $nav_menu_selecte
);
wp_defer_term_counting( true );
+
// Loop through all the menu items' POST variables.
if ( ! empty( $_POST['menu-item-db-id'] ) ) {
foreach ( (array) $_POST['menu-item-db-id'] as $_key => $k ) {
@@ -1209,19 +1212,22 @@ function wp_nav_menu_update_menu_items( $nav_menu_selected_id, $nav_menu_selecte
// Store 'auto-add' pages.
$auto_add = ! empty( $_POST['auto-add-pages'] );
$nav_menu_option = (array) get_option( 'nav_menu_options' );
+
if ( ! isset( $nav_menu_option['auto_add'] ) ) {
$nav_menu_option['auto_add'] = array();
}
+
if ( $auto_add ) {
- if ( ! in_array( $nav_menu_selected_id, $nav_menu_option['auto_add'] ) ) {
+ if ( ! in_array( $nav_menu_selected_id, $nav_menu_option['auto_add'], true ) ) {
$nav_menu_option['auto_add'][] = $nav_menu_selected_id;
}
} else {
- $key = array_search( $nav_menu_selected_id, $nav_menu_option['auto_add'] );
+ $key = array_search( $nav_menu_selected_id, $nav_menu_option['auto_add'], true );
if ( false !== $key ) {
unset( $nav_menu_option['auto_add'][ $key ] );
}
}
+
// Remove non-existent/deleted menus.
$nav_menu_option['auto_add'] = array_intersect( $nav_menu_option['auto_add'], wp_get_nav_menus( array( 'fields' => 'ids' ) ) );
update_option( 'nav_menu_options', $nav_menu_option );
diff --git a/wp-admin/includes/plugin.php b/wp-admin/includes/plugin.php
index 67f3d9bd40..9a8851afeb 100644
--- a/wp-admin/includes/plugin.php
+++ b/wp-admin/includes/plugin.php
@@ -2170,7 +2170,7 @@ function add_option_whitelist( $new_options, $options = '' ) {
$whitelist_options[ $page ] = array();
$whitelist_options[ $page ][] = $key;
} else {
- $pos = array_search( $key, $whitelist_options[ $page ] );
+ $pos = array_search( $key, $whitelist_options[ $page ], true );
if ( false === $pos ) {
$whitelist_options[ $page ][] = $key;
}
@@ -2202,7 +2202,7 @@ function remove_option_whitelist( $del_options, $options = '' ) {
foreach ( $del_options as $page => $keys ) {
foreach ( $keys as $key ) {
if ( isset( $whitelist_options[ $page ] ) && is_array( $whitelist_options[ $page ] ) ) {
- $pos = array_search( $key, $whitelist_options[ $page ] );
+ $pos = array_search( $key, $whitelist_options[ $page ], true );
if ( false !== $pos ) {
unset( $whitelist_options[ $page ][ $pos ] );
}
diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php
index b2143d61eb..a554932951 100644
--- a/wp-admin/includes/post.php
+++ b/wp-admin/includes/post.php
@@ -548,8 +548,8 @@ function bulk_edit_posts( $post_data = null ) {
$children[] = $parent;
foreach ( $pages as $page ) {
- if ( $page->ID == $parent ) {
- $parent = $page->post_parent;
+ if ( (int) $page->ID === $parent ) {
+ $parent = (int) $page->post_parent;
break;
}
}
@@ -568,7 +568,7 @@ function bulk_edit_posts( $post_data = null ) {
$post_type_object = get_post_type_object( get_post_type( $post_ID ) );
if ( ! isset( $post_type_object )
- || ( isset( $children ) && in_array( $post_ID, $children ) )
+ || ( isset( $children ) && in_array( $post_ID, $children, true ) )
|| ! current_user_can( 'edit_post', $post_ID )
) {
$skipped[] = $post_ID;
diff --git a/wp-admin/includes/revision.php b/wp-admin/includes/revision.php
index cbf4eaeb38..ac4f7de00e 100644
--- a/wp-admin/includes/revision.php
+++ b/wp-admin/includes/revision.php
@@ -314,7 +314,7 @@ function wp_prepare_revisions_for_js( $post, $selected_revision_id, $from = null
// Now, grab the initial diff.
$compare_two_mode = is_numeric( $from );
if ( ! $compare_two_mode ) {
- $found = array_search( $selected_revision_id, array_keys( $revisions ) );
+ $found = array_search( $selected_revision_id, array_keys( $revisions ), true );
if ( $found ) {
$from = array_keys( array_slice( $revisions, $found - 1, 1, true ) );
$from = reset( $from );
diff --git a/wp-admin/includes/screen.php b/wp-admin/includes/screen.php
index db6abfb5ce..75cc14a573 100644
--- a/wp-admin/includes/screen.php
+++ b/wp-admin/includes/screen.php
@@ -128,10 +128,12 @@ function meta_box_prefs( $screen ) {
$widget_title = $box['args']['__widget_basename'];
}
+ $is_hidden = in_array( $box['id'], $hidden, true );
+
printf(
'',
esc_attr( $box['id'] ),
- checked( in_array( $box['id'], $hidden, true ), false, false ),
+ checked( $is_hidden, false, false ),
$widget_title
);
}
diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php
index 882af9e149..c140849f6e 100644
--- a/wp-admin/includes/template.php
+++ b/wp-admin/includes/template.php
@@ -171,7 +171,7 @@ function wp_terms_checklist( $post_id = 0, $args = array() ) {
$keys = array_keys( $categories );
foreach ( $keys as $k ) {
- if ( in_array( $categories[ $k ]->term_id, $args['selected_cats'] ) ) {
+ if ( in_array( $categories[ $k ]->term_id, $args['selected_cats'], true ) ) {
$checked_categories[] = $categories[ $k ];
unset( $categories[ $k ] );
}
@@ -228,13 +228,14 @@ function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $ech
$tax = get_taxonomy( $taxonomy );
$popular_ids = array();
+
foreach ( (array) $terms as $term ) {
$popular_ids[] = $term->term_id;
if ( ! $echo ) { // Hack for Ajax use.
continue;
}
$id = "popular-$taxonomy-$term->term_id";
- $checked = in_array( $term->term_id, $checked_terms ) ? 'checked="checked"' : '';
+ $checked = in_array( $term->term_id, $checked_terms, true ) ? 'checked="checked"' : '';
?>
@@ -291,7 +292,7 @@ function wp_link_category_checklist( $link_id = 0 ) {
/** This filter is documented in wp-includes/category-template.php */
$name = esc_html( apply_filters( 'the_category', $category->name, '', '' ) );
- $checked = in_array( $cat_id, $checked_categories ) ? ' checked="checked"' : '';
+ $checked = in_array( $cat_id, $checked_categories, true ) ? ' checked="checked"' : '';
echo '';
}
}
@@ -339,6 +340,7 @@ function get_inline_data( $post ) {
}
$taxonomy_names = get_object_taxonomies( $post->post_type );
+
foreach ( $taxonomy_names as $taxonomy_name ) {
$taxonomy = get_taxonomy( $taxonomy_name );
@@ -721,7 +723,6 @@ function meta_form( $post = null ) {