wp/wp-admin/includes/post.php
changeset 22 8c2e4d02f4ef
parent 21 48c4eec2b7e6
--- a/wp/wp-admin/includes/post.php	Fri Sep 05 18:40:08 2025 +0200
+++ b/wp/wp-admin/includes/post.php	Fri Sep 05 18:52:52 2025 +0200
@@ -493,7 +493,13 @@
  *
  * @param array|null $post_data Optional. The array of post data to process.
  *                              Defaults to the `$_POST` superglobal.
- * @return array
+ * @return array {
+ *     An array of updated, skipped, and locked post IDs.
+ *
+ *     @type int[] $updated An array of updated post IDs.
+ *     @type int[] $skipped An array of skipped post IDs.
+ *     @type int[] $locked  An array of locked post IDs.
+ * }
  */
 function bulk_edit_posts( $post_data = null ) {
 	global $wpdb;
@@ -1171,7 +1177,7 @@
 		$url_id = (int) $url_match[2];
 		$rel_id = (int) $rel_match[1];
 
-		if ( ! $url_id || ! $rel_id || $url_id != $rel_id || ! str_contains( $url_match[0], $site_url ) ) {
+		if ( ! $url_id || ! $rel_id || $url_id !== $rel_id || ! str_contains( $url_match[0], $site_url ) ) {
 			continue;
 		}
 
@@ -1211,7 +1217,7 @@
  *
  * @param array|false $q Optional. Array of query variables to use to build the query.
  *                       Defaults to the `$_GET` superglobal.
- * @return array
+ * @return string[] An array of all the statuses for the queried post type.
  */
 function wp_edit_posts_query( $q = false ) {
 	if ( false === $q ) {
@@ -1383,7 +1389,12 @@
  *
  * @param array|false $q Optional. Array of query variables to use to build the query.
  *                       Defaults to the `$_GET` superglobal.
- * @return array
+ * @return array {
+ *     Array containing the post mime types and available post mime types.
+ *
+ *     @type array[]  $post_mime_types       Post mime types.
+ *     @type string[] $avail_post_mime_types Available post mime types.
+ * }
  */
 function wp_edit_attachments_query( $q = false ) {
 	wp( wp_edit_attachments_query_vars( $q ) );
@@ -1804,18 +1815,21 @@
 		$locked = false;
 	}
 
-	$sendback = wp_get_referer();
-	if ( $locked && $sendback && ! str_contains( $sendback, 'post.php' ) && ! str_contains( $sendback, 'post-new.php' ) ) {
-
-		$sendback_text = __( 'Go back' );
-	} else {
+	$sendback      = wp_get_referer();
+	$sendback_text = __( 'Go back' );
+
+	if ( ! $locked || ! $sendback || str_contains( $sendback, 'post.php' ) || str_contains( $sendback, 'post-new.php' ) ) {
 		$sendback = admin_url( 'edit.php' );
 
 		if ( 'post' !== $post->post_type ) {
 			$sendback = add_query_arg( 'post_type', $post->post_type, $sendback );
 		}
 
-		$sendback_text = get_post_type_object( $post->post_type )->labels->all_items;
+		$post_type_object = get_post_type_object( $post->post_type );
+
+		if ( $post_type_object ) {
+			$sendback_text = $post_type_object->labels->all_items;
+		}
 	}
 
 	$hidden = $locked ? '' : ' hidden';
@@ -2005,7 +2019,7 @@
 }
 
 /**
- * Autosave the revisioned meta fields.
+ * Autosaves the revisioned meta fields.
  *
  * Iterates through the revisioned meta fields and checks each to see if they are set,
  * and have a changed value. If so, the meta value is saved and attached to the autosave.
@@ -2027,15 +2041,14 @@
 	$post_type = get_post_type( $new_autosave['post_parent'] );
 
 	/*
-	 * Go thru the revisioned meta keys and save them as part of the autosave, if
-	 * the meta key is part of the posted data, the meta value is not blank and
-	 * the the meta value has changes from the last autosaved value.
+	 * Go through the revisioned meta keys and save them as part of the autosave,
+	 * if the meta key is part of the posted data, the meta value is not blank,
+	 * and the meta value has changes from the last autosaved value.
 	 */
 	foreach ( wp_post_revision_meta_keys( $post_type ) as $meta_key ) {
 
-		if (
-		isset( $posted_data[ $meta_key ] ) &&
-		get_post_meta( $new_autosave['ID'], $meta_key, true ) !== wp_unslash( $posted_data[ $meta_key ] )
+		if ( isset( $posted_data[ $meta_key ] )
+			&& get_post_meta( $new_autosave['ID'], $meta_key, true ) !== wp_unslash( $posted_data[ $meta_key ] )
 		) {
 			/*
 			 * Use the underlying delete_metadata() and add_metadata() functions
@@ -2044,13 +2057,9 @@
 			 */
 			delete_metadata( 'post', $new_autosave['ID'], $meta_key );
 
-			/*
-			 * One last check to ensure meta value not empty().
-			 */
+			// One last check to ensure meta value is not empty.
 			if ( ! empty( $posted_data[ $meta_key ] ) ) {
-				/*
-				 * Add the revisions meta data to the autosave.
-				 */
+				// Add the revisions meta data to the autosave.
 				add_metadata( 'post', $new_autosave['ID'], $meta_key, $posted_data[ $meta_key ] );
 			}
 		}