Index: src/wp-includes/post-template.php
===================================================================
--- src/wp-includes/post-template.php	(revision 39524)
+++ src/wp-includes/post-template.php	(working copy)
@@ -1631,6 +1631,10 @@
  * @return bool True on success, false on failure.
  */
 function is_page_template( $template = '' ) {
+	if ( ! is_singular() ) {
+		return false;
+	}
+
 	$page_template = get_page_template_slug( get_queried_object_id() );
 
 	if ( empty( $template ) )
Index: tests/phpunit/tests/query/conditionals.php
===================================================================
--- tests/phpunit/tests/query/conditionals.php	(revision 39524)
+++ tests/phpunit/tests/query/conditionals.php	(working copy)
@@ -1074,6 +1074,29 @@
 	}
 
 	/**
+	 * @ticket 39211
+	 */
+	function test_is_page_template_not_singular() {
+		global $wpdb;
+
+		// We need an non-post that shares an ID with a post assigned a template.
+		$user_id = self::factory()->user->create();
+		if ( ! get_post( $user_id ) ) {
+			$post_id = self::factory()->post->create( array( 'post_type' => 'post' ) );
+			$wpdb->update( $wpdb->posts, array( 'ID' => $user_id ), array( 'ID' => $post_id ), array( '%d' ) );
+		}
+
+		update_post_meta( $user_id, '_wp_page_template', 'example.php' );
+
+		// Verify that the non-post with our ID does not report having a template.
+		$this->go_to( get_post_permalink( $user_id ) );
+		$this->assertTrue( is_page_template( 'example.php' ) );
+		$this->go_to( get_author_posts_url( $user_id ) );
+		$this->assertInstanceOf( 'WP_User', get_queried_object() ); // and not something else that would return false, like a 404.
+		$this->assertFalse( is_page_template( 'example.php' ) );
+	}
+
+	/**
 	 * @ticket 35902
 	 */
 	public function test_is_attachment_should_not_match_numeric_id_to_post_title_beginning_with_id() {
