diff --git src/wp-includes/query.php src/wp-includes/query.php
index f076533..5cdf07e 100644
--- src/wp-includes/query.php
+++ src/wp-includes/query.php
@@ -1743,6 +1743,8 @@ class WP_Query {
 			$qv['withcomments'] = 1;
 		}
 
+		$this->resolve_numeric_slugs();
+
 		$this->is_singular = $this->is_single || $this->is_page || $this->is_attachment;
 
 		if ( $this->is_feed && ( !empty($qv['withcomments']) || ( empty($qv['withoutcomments']) && $this->is_singular ) ) )
@@ -2321,6 +2323,98 @@ class WP_Query {
 	}
 
 	/**
+	 * Resolves numeric slugs that collide with date permalinks.
+	 *
+	 * @since 4.2.0
+	 * @access protected
+	 */
+	protected function resolve_numeric_slugs() {
+		if ( ! $this->is_date ) {
+			return;
+		}
+
+		// Identify the 'postname' position in the permastruct array.
+		$permastructs = array_values( array_filter( explode( '/', get_option( 'permalink_structure' ) ) ) );
+
+		$postname_index = array_search( '%postname%', $permastructs );
+
+		if ( false === $postname_index ) {
+			return;
+		}
+
+		/*
+		 * A numeric slug could be confused with a year, month, or day, depending on position.
+		 * To account for the possibility of post pagination (eg 2015/2 for the second page of a post called
+		 * '2015'), our `is_*` checks are generous: check for year-slug clashes when `is_year` *or* `is_month`,
+		 * and check for month-slug clashes when `is_month` *or* `is_day`.
+		 */
+		$compare = '';
+		if ( 0 === $postname_index && ( $this->is_year || $this->is_month ) ) {
+			$compare = 'year';
+		} else if ( '%year%' === $permastructs[ $postname_index - 1 ] && ( $this->is_month || $this->is_day ) ) {
+			$compare = 'monthnum';
+		} else if ( '%monthnum%' === $permastructs[ $postname_index - 1 ] && $this->is_day ) {
+			$compare = 'day';
+		}
+
+		if ( ! $compare ) {
+			return;
+		}
+
+		// Set the value of the numeric slug
+		$value = $this->get( $compare );
+
+		// Check the original query var for a leading zero and zeroise `$value` if needed. 
+		if ( 'year' !== $compare ) {
+			if ( isset( $this->query[ $compare ] ) && substr( $this->query[ $compare ], 0, 1 ) === '0' ) {
+				$value = zeroise( $value, 2 );
+			}
+		}
+
+		$post = get_page_by_path( $value, OBJECT, 'post' );
+		if ( ! ( $post instanceof WP_Post ) ) {
+			return;
+		}
+
+		// Set the page value
+		$page = '';
+		if ( 'year' === $compare && $this->is_month ) {
+			$page = $this->get( 'monthnum' );
+		} else if ( 'monthnum' === $compare && $this->is_day ) {
+			$page = $this->get( 'day' );
+		}
+
+		// If the page is not valid, bail!
+		if ( '' !== $page && false !== strpos( $post->post_content, '<!--nextpage-->' ) && ( $page - 1 ) > substr_count( $post->post_content, '<!--nextpage-->' ) ) {
+			return;
+		}
+
+		/*
+		 * If we've gotten to this point, we have a slug/date clash.
+		 * First, attempt to adjust pagination, which would have previously been identified as 
+		 * part of the date query.
+		 */
+		if ( '' !== $page ) {
+			$this->set( 'page', $page );
+		}
+
+		// Next, unset autodetected date-related query vars.
+		$this->is_archive = false;
+		$this->is_date    = false;
+		$this->is_year    = false;
+		$this->is_month   = false;
+		$this->is_day     = false;
+		$this->set( 'year', '' );
+		$this->set( 'monthnum', '' );
+		$this->set( 'day', '' );
+
+		// Finally, tell the query that it's a singular query for the identified post.
+		$this->is_single   = true;
+		$this->is_singular = true;
+		$this->set( 'name', $post->post_name );
+	}
+
+	/**
 	 * Sets the 404 property and saves whether query is feed.
 	 *
 	 * @since 2.0.0
diff --git tests/phpunit/tests/post.php tests/phpunit/tests/post.php
index ae549e0..7ebf18e 100644
--- tests/phpunit/tests/post.php
+++ tests/phpunit/tests/post.php
@@ -470,6 +470,248 @@ class Tests_Post extends WP_UnitTestCase {
 	}
 
 	/**
+	 * @ticket 5305
+	 */
+	function test_permalink_year_segment_collision_without_title() {
+		global $wp_rewrite, $wpdb;
+		$wp_rewrite->init();
+		$wp_rewrite->set_permalink_structure( '/%postname%/' );
+		$wp_rewrite->flush_rules();
+
+		$id = $this->factory->post->create( array(
+			'post_author'  => $this->author_id,
+			'post_status'  => 'publish',
+			'post_content' => rand_str(),
+			'post_title'   => '',
+			'post_name'    => '2015',
+			'post_date'    => '2015-02-01 01:00:00'
+		) );
+
+		// Force an ID that resembles a year format
+		$wpdb->update(
+			$wpdb->posts,
+			array(
+				'ID'   => '2015',
+				'guid' => 'http://example.org/?p=2015'
+			),
+			array( 'ID' => $id )
+		);
+
+		$this->go_to( get_permalink( '2015' ) );
+
+		$this->assertQueryTrue( 'is_single', 'is_singular' );
+
+		$wp_rewrite->set_permalink_structure('');
+	}
+
+	/**
+	 * @ticket 5305
+	 */
+	function test_permalink_year_segment_collision_with_title() {
+		global $wp_rewrite;
+		$wp_rewrite->init();
+		$wp_rewrite->set_permalink_structure( '/%postname%/' );
+		$wp_rewrite->flush_rules();
+
+		$id = $this->factory->post->create( array(
+			'post_author'  => $this->author_id,
+			'post_status'  => 'publish',
+			'post_content' => rand_str(),
+			'post_title'   => '2015',
+			'post_date'    => '2015-02-01 01:00:00',
+		) );
+
+		$this->assertEquals( $id, url_to_postid( get_permalink( $id ) ) );
+
+		$wp_rewrite->set_permalink_structure('');
+	}
+
+	/**
+	 * @ticket 5305
+	 */
+	function test_permalink_month_segment_collision_without_title() {
+		global $wp_rewrite;
+		$wp_rewrite->init();
+		$wp_rewrite->set_permalink_structure( '/%year%/%postname%/' );
+		$wp_rewrite->flush_rules();
+
+		$id = $this->factory->post->create( array(
+			'post_author'  => $this->author_id,
+			'post_status'  => 'publish',
+			'post_content' => rand_str(),
+			'post_title'   => '',
+			'post_name'    => '02',
+			'post_date'    => '2015-02-01 01:00:00',
+		) );
+
+		$this->go_to( get_permalink( $id ) );
+
+		$this->assertQueryTrue( 'is_single', 'is_singular' );
+
+		$wp_rewrite->set_permalink_structure('');
+	}
+	
+	/**
+	 * @ticket 5305
+	 */
+	function test_permalink_month_segment_collision_without_title_no_leading_zero() {
+		global $wp_rewrite;
+		$wp_rewrite->init();
+		$wp_rewrite->set_permalink_structure( '/%year%/%postname%/' );
+		$wp_rewrite->flush_rules();
+
+		$id = $this->factory->post->create( array(
+			'post_author'  => $this->author_id,
+			'post_status'  => 'publish',
+			'post_content' => rand_str(),
+			'post_title'   => '',
+			'post_name'    => '2',
+			'post_date'    => '2015-02-01 01:00:00',
+		) );
+
+		$this->go_to( get_permalink( $id ) );
+
+		$this->assertQueryTrue( 'is_single', 'is_singular' );
+
+		$wp_rewrite->set_permalink_structure('');
+	}
+
+	/**
+	 * @ticket 5305
+	 */
+	function test_permalink_month_segment_collision_with_title() {
+		global $wp_rewrite;
+		$wp_rewrite->init();
+		$wp_rewrite->set_permalink_structure( '/%year%/%postname%/' );
+		$wp_rewrite->flush_rules();
+
+		$id = $this->factory->post->create( array(
+			'post_author'  => $this->author_id,
+			'post_status'  => 'publish',
+			'post_content' => rand_str(),
+			'post_title'   => '02',
+			'post_date'    => '2015-02-01 01:00:00',
+		) );
+
+		$this->assertEquals( $id, url_to_postid( get_permalink( $id ) ) );
+
+		$wp_rewrite->set_permalink_structure('');
+	}
+	
+	/**
+	 * @ticket 5305
+	 */
+	function test_permalink_month_segment_collision_with_title_no_leading_zero() {
+		global $wp_rewrite;
+		$wp_rewrite->init();
+		$wp_rewrite->set_permalink_structure( '/%year%/%postname%/' );
+		$wp_rewrite->flush_rules();
+
+		$id = $this->factory->post->create( array(
+			'post_author'  => $this->author_id,
+			'post_status'  => 'publish',
+			'post_content' => rand_str(),
+			'post_title'   => '2',
+			'post_date'    => '2015-02-01 01:00:00',
+		) );
+
+		$this->assertEquals( $id, url_to_postid( get_permalink( $id ) ) );
+
+		$wp_rewrite->set_permalink_structure('');
+	}
+
+	/**
+	 * @ticket 5305
+	 */
+	function test_permalink_day_segment_collision_without_title() {
+		global $wp_rewrite;
+		$wp_rewrite->init();
+		$wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%postname%/' );
+		$wp_rewrite->flush_rules();
+
+		$id = $this->factory->post->create( array(
+			'post_author'  => $this->author_id,
+			'post_status'  => 'publish',
+			'post_content' => rand_str(),
+			'post_title'   => '',
+			'post_name'    => '01',
+			'post_date'    => '2015-02-01 01:00:00',
+		) );
+
+		$this->go_to( get_permalink( $id ) );
+
+		$this->assertQueryTrue( 'is_single', 'is_singular' );
+
+		$wp_rewrite->set_permalink_structure('');
+	}
+
+	/**
+	 * @ticket 5305
+	 */
+	function test_permalink_day_segment_collision_with_title() {
+		global $wp_rewrite;
+		$wp_rewrite->init();
+		$wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%postname%/' );
+		$wp_rewrite->flush_rules();
+
+		$id = $this->factory->post->create( array(
+			'post_author'  => $this->author_id,
+			'post_status'  => 'publish',
+			'post_content' => rand_str(),
+			'post_title'   => '01',
+			'post_date'    => '2015-02-01 01:00:00',
+		) );
+
+		$this->assertEquals( $id, url_to_postid( get_permalink( $id ) ) );
+
+		$wp_rewrite->set_permalink_structure('');
+	}
+
+	/**
+	 * @ticket 5305
+	 */
+	public function test_date_slug_collision_should_distinguish_valid_pagination_from_date() {
+		global $wp_rewrite;
+		$wp_rewrite->init();
+		$wp_rewrite->set_permalink_structure( '/%year%/%postname%/' );
+		$wp_rewrite->flush_rules();
+
+		$id = $this->factory->post->create( array(
+			'post_author'  => $this->author_id,
+			'post_status'  => 'publish',
+			'post_content' => 'Page 0<!--nextpage-->Page 1<!--nextpage-->Page 2<!--nextpage-->Page 3',
+			'post_title'   => '02',
+			'post_date'    => '2015-02-01 01:00:00',
+		) );
+
+		$this->go_to( get_permalink( $id ) . '1' );
+
+		$this->assertFalse( is_day() );
+	}
+	
+	/**
+	 * @ticket 5305
+	 */
+	public function test_date_slug_collision_should_distinguish_invalid_pagination_from_date() {
+		global $wp_rewrite;
+		$wp_rewrite->init();
+		$wp_rewrite->set_permalink_structure( '/%year%/%postname%/' );
+		$wp_rewrite->flush_rules();
+
+		$id = $this->factory->post->create( array(
+			'post_author'  => $this->author_id,
+			'post_status'  => 'publish',
+			'post_content' => 'Page 0<!--nextpage-->Page 1<!--nextpage-->Page 2<!--nextpage-->Page 3',
+			'post_title'   => '02',
+			'post_date'    => '2015-02-05 01:00:00',
+		) );
+		
+		$this->go_to( get_permalink( $id ) . '5' );
+
+		$this->assertTrue( is_day() );
+	}
+
+	/**
 	 * @ticket 21013
 	 */
 	function test_wp_unique_post_slug_with_non_latin_slugs() {
