Index: src/wp-includes/class-wp-query.php
===================================================================
--- src/wp-includes/class-wp-query.php	(revision 61303)
+++ src/wp-includes/class-wp-query.php	(working copy)
@@ -3970,91 +3970,125 @@
 	 * @return WP_Term|WP_Post_Type|WP_Post|WP_User|null The queried object.
 	 */
 	public function get_queried_object() {
-		if ( isset( $this->queried_object ) ) {
-			return $this->queried_object;
-		}
+	    if ( isset( $this->queried_object ) ) {
+	        return $this->queried_object;
+	    }
 
-		$this->queried_object    = null;
-		$this->queried_object_id = null;
+	    $this->queried_object    = null;
+	    $this->queried_object_id = null;
 
-		if ( $this->is_category || $this->is_tag || $this->is_tax ) {
-			if ( $this->is_category ) {
-				$cat           = $this->get( 'cat' );
-				$category_name = $this->get( 'category_name' );
+	    if ( $this->is_category || $this->is_tag || $this->is_tax ) {
 
-				if ( $cat ) {
-					$term = get_term( $cat, 'category' );
-				} elseif ( $category_name ) {
-					$term = get_term_by( 'slug', $category_name, 'category' );
-				}
-			} elseif ( $this->is_tag ) {
-				$tag_id = $this->get( 'tag_id' );
-				$tag    = $this->get( 'tag' );
+	        if ( $this->is_category ) {
+	            $cat           = $this->get( 'cat' );
+	            $category_name = $this->get( 'category_name' );
 
-				if ( $tag_id ) {
-					$term = get_term( $tag_id, 'post_tag' );
-				} elseif ( $tag ) {
-					$term = get_term_by( 'slug', $tag, 'post_tag' );
-				}
-			} else {
-				// For other tax queries, grab the first term from the first clause.
-				if ( ! empty( $this->tax_query->queried_terms ) ) {
-					$queried_taxonomies = array_keys( $this->tax_query->queried_terms );
-					$matched_taxonomy   = reset( $queried_taxonomies );
-					$query              = $this->tax_query->queried_terms[ $matched_taxonomy ];
+	            if ( $cat ) {
+	                $term = get_term( $cat, 'category' );
+	            } elseif ( $category_name ) {
+	                $term = get_term_by( 'slug', $category_name, 'category' );
+	            }
 
-					if ( ! empty( $query['terms'] ) ) {
-						if ( 'term_id' === $query['field'] ) {
-							$term = get_term( reset( $query['terms'] ), $matched_taxonomy );
-						} else {
-							$term = get_term_by( $query['field'], reset( $query['terms'] ), $matched_taxonomy );
-						}
-					}
-				}
-			}
+	        } elseif ( $this->is_tag ) {
+	            $tag_id = $this->get( 'tag_id' );
+	            $tag    = $this->get( 'tag' );
 
-			if ( ! empty( $term ) && ! is_wp_error( $term ) ) {
-				$this->queried_object    = $term;
-				$this->queried_object_id = (int) $term->term_id;
+	            if ( $tag_id ) {
+	                $term = get_term( $tag_id, 'post_tag' );
+	            } elseif ( $tag ) {
+	                $term = get_term_by( 'slug', $tag, 'post_tag' );
+	            }
 
-				if ( $this->is_category && 'category' === $this->queried_object->taxonomy ) {
-					_make_cat_compat( $this->queried_object );
-				}
-			}
-		} elseif ( $this->is_post_type_archive ) {
-			$post_type = $this->get( 'post_type' );
+	        } else {
+	            // For other tax queries, grab the first term from the first clause.
+	            if ( ! empty( $this->tax_query->queried_terms ) ) {
+	                $queried_taxonomies = array_keys( $this->tax_query->queried_terms );
+	                $matched_taxonomy   = reset( $queried_taxonomies );
+	                $query              = $this->tax_query->queried_terms[ $matched_taxonomy ];
 
-			if ( is_array( $post_type ) ) {
-				$post_type = reset( $post_type );
-			}
+	                if ( ! empty( $query['terms'] ) ) {
+	                    if ( 'term_id' === $query['field'] ) {
+	                        $term = get_term( reset( $query['terms'] ), $matched_taxonomy );
+	                    } else {
+	                        $term = get_term_by( $query['field'], reset( $query['terms'] ), $matched_taxonomy );
+	                    }
+	                }
+	            }
+	        }
 
-			$this->queried_object = get_post_type_object( $post_type );
-		} elseif ( $this->is_posts_page ) {
-			$page_for_posts = get_option( 'page_for_posts' );
+	        if ( ! empty( $term ) && ! is_wp_error( $term ) ) {
+	            $this->queried_object    = $term;
+	            $this->queried_object_id = (int) $term->term_id;
 
-			$this->queried_object    = get_post( $page_for_posts );
-			$this->queried_object_id = (int) $this->queried_object->ID;
-		} elseif ( $this->is_singular && ! empty( $this->post ) ) {
-			$this->queried_object    = $this->post;
-			$this->queried_object_id = (int) $this->post->ID;
-		} elseif ( $this->is_author ) {
-			$author      = (int) $this->get( 'author' );
-			$author_name = $this->get( 'author_name' );
+	            if ( $this->is_category && 'category' === $this->queried_object->taxonomy ) {
+	                _make_cat_compat( $this->queried_object );
+	            }
+	        }
 
-			if ( $author ) {
-				$this->queried_object_id = $author;
-			} elseif ( $author_name ) {
-				$user = get_user_by( 'slug', $author_name );
+	    } elseif ( $this->is_post_type_archive ) {
 
-				if ( $user ) {
-					$this->queried_object_id = $user->ID;
-				}
-			}
+	        $post_type = $this->get( 'post_type' );
+	        if ( is_array( $post_type ) ) {
+	            $post_type = reset( $post_type );
+	        }
 
-			$this->queried_object = get_userdata( $this->queried_object_id );
-		}
+	        $this->queried_object = get_post_type_object( $post_type );
 
-		return $this->queried_object;
+	    } elseif ( $this->is_posts_page ) {
+
+	        $page_for_posts = get_option( 'page_for_posts' );
+
+	        $this->queried_object    = get_post( $page_for_posts );
+	        $this->queried_object_id = (int) $this->queried_object->ID;
+
+	    } elseif ( $this->is_singular && ! empty( $this->post ) ) {
+
+	        $this->queried_object    = $this->post;
+	        $this->queried_object_id = (int) $this->post->ID;
+
+	    } elseif ( $this->is_author ) {
+
+	        $author      = (int) $this->get( 'author' );
+	        $author_name = $this->get( 'author_name' );
+
+	        if ( $author ) {
+	            $this->queried_object_id = $author;
+	        } elseif ( $author_name ) {
+	            $user = get_user_by( 'slug', $author_name );
+	            if ( $user ) {
+	                $this->queried_object_id = $user->ID;
+	            }
+	        }
+
+	        $this->queried_object = get_userdata( $this->queried_object_id );
+	    }
+
+	    /**
+	     * ----------------------------------------------------------
+	     *  FIX 1: Homepage = "Your latest posts" → return post object
+	     * ----------------------------------------------------------
+	     */
+	    if ( $this->is_home && ! $this->is_posts_page && null === $this->queried_object ) {
+	        $this->queried_object = get_post_type_object( 'post' );
+	        return $this->queried_object;
+	    }
+
+	    /**
+	     * ----------------------------------------------------------
+	     * FIX 2: Date archives → return date object instead of null
+	     * ----------------------------------------------------------
+	     */
+	    if ( $this->is_date && null === $this->queried_object ) {
+	        $date_obj = new stdClass();
+	        $date_obj->year     = get_query_var( 'year' );
+	        $date_obj->monthnum = get_query_var( 'monthnum' );
+	        $date_obj->day      = get_query_var( 'day' );
+
+	        $this->queried_object = $date_obj;
+	        return $this->queried_object;
+	    }
+
+	    return $this->queried_object;
 	}
 
 	/**
