Index: src/wp-includes/general-template.php
===================================================================
--- src/wp-includes/general-template.php	(revision 37650)
+++ src/wp-includes/general-template.php	(working copy)
@@ -1634,6 +1634,12 @@
  *     @type string     $order           Whether to use ascending or descending order. Accepts 'ASC', or 'DESC'.
  *                                       Default 'DESC'.
  *     @type string     $post_type       Post type. Default 'post'.
+ *     @type string     $title           List heading. Passing a null or empty value will result in no heading, and the list
+ *                                       will not be wrapped and $title_before and $title_after become useless. Default ''.
+ *     @type string     $title_before    Text or HTML to precede the title. Default ''.
+ *     @type string     $title_after     Text or HTML to follow the title. Default ''.
+ *     @type string     $list_before     Text or HTML to precede the list. Default ''.
+ *     @type string     $list_after      Text or HTML to follow the list. Default ''.
  * }
  * @return string|void String when retrieving.
  */
@@ -1645,7 +1651,9 @@
 		'format' => 'html', 'before' => '',
 		'after' => '', 'show_post_count' => false,
 		'echo' => 1, 'order' => 'DESC',
-		'post_type' => 'post'
+		'post_type' => 'post', 'title' => '',
+		'title_before' => '', 'title_after' => '',
+		'list_before' => '', 'list_after' => ''
 	);
 
 	$r = wp_parse_args( $args, $defaults );
@@ -1697,6 +1705,14 @@
 
 	$output = '';
 
+	if ( '' != $r['title'] ) {
+		$output .= $r['title_before']. $r['title']. $r['title_after'];
+	}
+
+	if ( $r['list_before'] ) {
+		$output .= $r['list_before'];
+	}
+
 	$last_changed = wp_cache_get( 'last_changed', 'posts' );
 	if ( ! $last_changed ) {
 		$last_changed = microtime();
@@ -1828,6 +1844,11 @@
 			}
 		}
 	}
+
+	if ( $r['list_after'] ) {
+		$output .= $r['list_after'];
+	}
+
 	if ( $r['echo'] ) {
 		echo $output;
 	} else {
Index: src/wp-includes/post-template.php
===================================================================
--- src/wp-includes/post-template.php	(revision 37650)
+++ src/wp-includes/post-template.php	(working copy)
@@ -1131,6 +1131,8 @@
  *     @type string $title_li     List heading. Passing a null or empty value will result in no heading, and the list
  *                                will not be wrapped with unordered list `<ul>` tags. Default 'Pages'.
  *     @type Walker $walker       Walker instance to use for listing pages. Default empty (Walker_Page).
+ *     @type string $before       Text or HTML to precede the list of pages. Default <li class="pagenav">
+ *     @type string $after        Text or HTML to follow the list of pages. Default </li>
  * }
  * @return string|void HTML list of pages.
  */
@@ -1142,6 +1144,7 @@
 		'title_li' => __( 'Pages' ), 'echo' => 1,
 		'authors' => '', 'sort_column' => 'menu_order, post_title',
 		'link_before' => '', 'link_after' => '', 'walker' => '',
+		'before' => '<li class="pagenav">', 'after' => '</li>'
 	);
 
 	$r = wp_parse_args( $args, $defaults );
@@ -1170,7 +1173,7 @@
 
 	if ( ! empty( $pages ) ) {
 		if ( $r['title_li'] ) {
-			$output .= '<li class="pagenav">' . $r['title_li'] . '<ul>';
+			$output .= $r['before'] . $r['title_li'] . '<ul>';
 		}
 		global $wp_query;
 		if ( is_page() || is_attachment() || $wp_query->is_posts_page ) {
@@ -1185,7 +1188,7 @@
 		$output .= walk_page_tree( $pages, $r['depth'], $current_page, $r );
 
 		if ( $r['title_li'] ) {
-			$output .= '</ul></li>';
+			$output .= '</ul>' . $r['after'];
 		}
 	}
 
Index: src/wp-includes/post.php
===================================================================
--- src/wp-includes/post.php	(revision 37650)
+++ src/wp-includes/post.php	(working copy)
@@ -4326,30 +4326,24 @@
  * @return WP_Post|array|void WP_Post on success or null on failure
  */
 function get_page_by_title( $page_title, $output = OBJECT, $post_type = 'page' ) {
-	global $wpdb;
 
-	if ( is_array( $post_type ) ) {
-		$post_type = esc_sql( $post_type );
-		$post_type_in_string = "'" . implode( "','", $post_type ) . "'";
-		$sql = $wpdb->prepare( "
-			SELECT ID
-			FROM $wpdb->posts
-			WHERE post_title = %s
-			AND post_type IN ($post_type_in_string)
-		", $page_title );
-	} else {
-		$sql = $wpdb->prepare( "
-			SELECT ID
-			FROM $wpdb->posts
-			WHERE post_title = %s
-			AND post_type = %s
-		", $page_title, $post_type );
-	}
+	// Make sure that we even query post statuses that are excluded from search
+	$post_status = array_values( get_post_stati( array( 'exclude_from_search' => true ) ) );
 
-	$page = $wpdb->get_var( $sql );
+	$query = new WP_Query(
+		array(
+			'title'          => $page_title,
+			'post_type'      => $post_type,
+			'posts_per_page' => 1,
+			'post_status'    => array_merge( $post_status, array( 'any' ) ),
+			'orderby'        => 'none',
+			'fields'         => 'ids'
+		)
+	);
+	$posts = $query->get_posts();
 
-	if ( $page ) {
-		return get_post( $page, $output );
+	if ( $posts ) {
+		return get_post( $posts[0], $output );
 	}
 }
 
Index: tests/phpunit/tests/functions/getArchives.php
===================================================================
--- tests/phpunit/tests/functions/getArchives.php	(revision 37650)
+++ tests/phpunit/tests/functions/getArchives.php	(working copy)
@@ -122,4 +122,41 @@
 		$archives = wp_get_archives( array( 'echo' => false, 'post_type' => 'taco' ) );
 		$this->assertEquals( $expected, trim( $archives ) );
 	}
+
+	/**
+	 * @ticket 4969
+	 */
+	function test_wp_get_archives_title() {
+		$expected = "<h1>Archives Title</h1>\t<li><a href='$this->month_url'>" . date( 'F Y' ) . "</a></li>";
+		$result = trim( wp_get_archives(
+			array(
+				'echo'  => false,
+				'title' => 'Archives Title',
+				'title_before' => '<h1>',
+				'title_after' => '</h1>',
+			)
+		) );
+
+		$this->assertEquals( $expected, $result );
+	}
+
+	/**
+	 * @ticket 4969
+	 */
+	function test_wp_get_archives_before_and_after_list() {
+		$date = date( 'F Y' );
+		$expected = <<<EOF
+<ul>\t<li><a href='$this->month_url'>$date</a></li>
+</ul>
+EOF;
+		$result = trim( wp_get_archives(
+			array(
+				'echo'  => false,
+				'list_before' => '<ul>',
+				'list_after' => '</ul>',
+			)
+		) );
+
+		$this->assertEquals( $expected, $result );
+	}
 }
Index: tests/phpunit/tests/post/listPages.php
===================================================================
--- tests/phpunit/tests/post/listPages.php	(revision 37650)
+++ tests/phpunit/tests/post/listPages.php	(working copy)
@@ -342,4 +342,43 @@
 		$actual = wp_list_pages( $args );
 		$this->AssertEquals( $expected['exclude'], $actual );
 	}
+
+	/**
+	 * @ticket 4969
+	 */
+	function test_wp_get_pages_before_and_after() {
+		$expected = '<div>The Pages<ul><li class="page_item page-item-1 page_item_has_children"><a href="' . get_permalink( 1 ) . '">Parent 1</a>
+<ul class=\'children\'>
+	<li class="page_item page-item-4"><a href="' . get_permalink( 4 ) . '">Child 1</a></li>
+	<li class="page_item page-item-5"><a href="' . get_permalink( 5 ) . '">Child 2</a></li>
+	<li class="page_item page-item-6"><a href="' . get_permalink( 6 ) . '">Child 3</a></li>
+</ul>
+</li>
+<li class="page_item page-item-2 page_item_has_children"><a href="' . get_permalink( 2 ) . '">Parent 2</a>
+<ul class=\'children\'>
+	<li class="page_item page-item-7"><a href="' . get_permalink( 7 ) . '">Child 1</a></li>
+	<li class="page_item page-item-8"><a href="' . get_permalink( 8 ) . '">Child 2</a></li>
+	<li class="page_item page-item-9"><a href="' . get_permalink( 9 ) . '">Child 3</a></li>
+</ul>
+</li>
+<li class="page_item page-item-3 page_item_has_children"><a href="' . get_permalink( 3 ) . '">Parent 3</a>
+<ul class=\'children\'>
+	<li class="page_item page-item-10"><a href="' . get_permalink( 10 ) . '">Child 1</a></li>
+	<li class="page_item page-item-11"><a href="' . get_permalink( 11 ) . '">Child 2</a></li>
+	<li class="page_item page-item-12"><a href="' . get_permalink( 12 ) . '">Child 3</a></li>
+</ul>
+</li>
+</ul></div>';
+
+		$result = trim( wp_list_pages(
+			array(
+				'echo'  => false,
+				'before' => '<div>',
+				'after' => '</div>',
+				'title_li' => 'The Pages'
+			)
+		) );
+
+		$this->assertEquals( $expected, $result );
+	}
 }
