diff --git src/wp-admin/includes/export.php src/wp-admin/includes/export.php
index 70a03b7..6703cdf 100644
--- src/wp-admin/includes/export.php
+++ src/wp-admin/includes/export.php
@@ -137,242 +137,6 @@ function export_wp( $args = array() ) {
 		unset( $categories, $custom_taxonomies, $custom_terms );
 	}
 
-	/**
-	 * Wrap given string in XML CDATA tag.
-	 *
-	 * @since 2.1.0
-	 *
-	 * @param string $str String to wrap in XML CDATA tag.
-	 * @return string
-	 */
-	function wxr_cdata( $str ) {
-		if ( ! seems_utf8( $str ) ) {
-			$str = utf8_encode( $str );
-		}
-		// $str = ent2ncr(esc_html($str));
-		$str = '<![CDATA[' . str_replace( ']]>', ']]]]><![CDATA[>', $str ) . ']]>';
-
-		return $str;
-	}
-
-	/**
-	 * Return the URL of the site
-	 *
-	 * @since 2.5.0
-	 *
-	 * @return string Site URL.
-	 */
-	function wxr_site_url() {
-		// Multisite: the base URL.
-		if ( is_multisite() )
-			return network_home_url();
-		// WordPress (single site): the blog URL.
-		else
-			return get_bloginfo_rss( 'url' );
-	}
-
-	/**
-	 * Output a cat_name XML tag from a given category object
-	 *
-	 * @since 2.1.0
-	 *
-	 * @param object $category Category Object
-	 */
-	function wxr_cat_name( $category ) {
-		if ( empty( $category->name ) )
-			return;
-
-		echo '<wp:cat_name>' . wxr_cdata( $category->name ) . "</wp:cat_name>\n";
-	}
-
-	/**
-	 * Output a category_description XML tag from a given category object
-	 *
-	 * @since 2.1.0
-	 *
-	 * @param object $category Category Object
-	 */
-	function wxr_category_description( $category ) {
-		if ( empty( $category->description ) )
-			return;
-
-		echo '<wp:category_description>' . wxr_cdata( $category->description ) . "</wp:category_description>\n";
-	}
-
-	/**
-	 * Output a tag_name XML tag from a given tag object
-	 *
-	 * @since 2.3.0
-	 *
-	 * @param object $tag Tag Object
-	 */
-	function wxr_tag_name( $tag ) {
-		if ( empty( $tag->name ) )
-			return;
-
-		echo '<wp:tag_name>' . wxr_cdata( $tag->name ) . "</wp:tag_name>\n";
-	}
-
-	/**
-	 * Output a tag_description XML tag from a given tag object
-	 *
-	 * @since 2.3.0
-	 *
-	 * @param object $tag Tag Object
-	 */
-	function wxr_tag_description( $tag ) {
-		if ( empty( $tag->description ) )
-			return;
-
-		echo '<wp:tag_description>' . wxr_cdata( $tag->description ) . "</wp:tag_description>\n";
-	}
-
-	/**
-	 * Output a term_name XML tag from a given term object
-	 *
-	 * @since 2.9.0
-	 *
-	 * @param object $term Term Object
-	 */
-	function wxr_term_name( $term ) {
-		if ( empty( $term->name ) )
-			return;
-
-		echo '<wp:term_name>' . wxr_cdata( $term->name ) . "</wp:term_name>\n";
-	}
-
-	/**
-	 * Output a term_description XML tag from a given term object
-	 *
-	 * @since 2.9.0
-	 *
-	 * @param object $term Term Object
-	 */
-	function wxr_term_description( $term ) {
-		if ( empty( $term->description ) )
-			return;
-
-		echo "\t\t<wp:term_description>" . wxr_cdata( $term->description ) . "</wp:term_description>\n";
-	}
-
-	/**
-	 * Output termmeta XML tags for a given term object.
-	 *
-	 * @since 4.6.0
-	 *
-	 * @param WP_Term $term Term object.
-	 */
-	function wxr_term_meta( $term ) {
-		global $wpdb;
-
-		$termmeta = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->termmeta WHERE term_id = %d", $term->term_id ) );
-
-		foreach ( $termmeta as $meta ) {
-			/**
-			 * Filters whether to selectively skip term meta used for WXR exports.
-			 *
-			 * Returning a truthy value to the filter will skip the current meta
-			 * object from being exported.
-			 *
-			 * @since 4.6.0
-			 *
-			 * @param bool   $skip     Whether to skip the current piece of term meta. Default false.
-			 * @param string $meta_key Current meta key.
-			 * @param object $meta     Current meta object.
-			 */
-			if ( ! apply_filters( 'wxr_export_skip_termmeta', false, $meta->meta_key, $meta ) ) {
-				printf( "\t\t<wp:termmeta>\n\t\t\t<wp:meta_key>%s</wp:meta_key>\n\t\t\t<wp:meta_value>%s</wp:meta_value>\n\t\t</wp:termmeta>\n", wxr_cdata( $meta->meta_key ), wxr_cdata( $meta->meta_value ) );
-			}
-		}
-	}
-
-	/**
-	 * Output list of authors with posts
-	 *
-	 * @since 3.1.0
-	 *
-	 * @global wpdb $wpdb WordPress database abstraction object.
-	 *
-	 * @param array $post_ids Array of post IDs to filter the query by. Optional.
-	 */
-	function wxr_authors_list( array $post_ids = null ) {
-		global $wpdb;
-
-		if ( !empty( $post_ids ) ) {
-			$post_ids = array_map( 'absint', $post_ids );
-			$and = 'AND ID IN ( ' . implode( ', ', $post_ids ) . ')';
-		} else {
-			$and = '';
-		}
-
-		$authors = array();
-		$results = $wpdb->get_results( "SELECT DISTINCT post_author FROM $wpdb->posts WHERE post_status != 'auto-draft' $and" );
-		foreach ( (array) $results as $result )
-			$authors[] = get_userdata( $result->post_author );
-
-		$authors = array_filter( $authors );
-
-		foreach ( $authors as $author ) {
-			echo "\t<wp:author>";
-			echo '<wp:author_id>' . intval( $author->ID ) . '</wp:author_id>';
-			echo '<wp:author_login>' . wxr_cdata( $author->user_login ) . '</wp:author_login>';
-			echo '<wp:author_email>' . wxr_cdata( $author->user_email ) . '</wp:author_email>';
-			echo '<wp:author_display_name>' . wxr_cdata( $author->display_name ) . '</wp:author_display_name>';
-			echo '<wp:author_first_name>' . wxr_cdata( $author->first_name ) . '</wp:author_first_name>';
-			echo '<wp:author_last_name>' . wxr_cdata( $author->last_name ) . '</wp:author_last_name>';
-			echo "</wp:author>\n";
-		}
-	}
-
-	/**
-	 * Ouput all navigation menu terms
-	 *
-	 * @since 3.1.0
-	 */
-	function wxr_nav_menu_terms() {
-		$nav_menus = wp_get_nav_menus();
-		if ( empty( $nav_menus ) || ! is_array( $nav_menus ) )
-			return;
-
-		foreach ( $nav_menus as $menu ) {
-			echo "\t<wp:term>";
-			echo '<wp:term_id>' . intval( $menu->term_id ) . '</wp:term_id>';
-			echo '<wp:term_taxonomy>nav_menu</wp:term_taxonomy>';
-			echo '<wp:term_slug>' . wxr_cdata( $menu->slug ) . '</wp:term_slug>';
-			wxr_term_name( $menu );
-			echo "</wp:term>\n";
-		}
-	}
-
-	/**
-	 * Output list of taxonomy terms, in XML tag format, associated with a post
-	 *
-	 * @since 2.3.0
-	 */
-	function wxr_post_taxonomy() {
-		$post = get_post();
-
-		$taxonomies = get_object_taxonomies( $post->post_type );
-		if ( empty( $taxonomies ) )
-			return;
-		$terms = wp_get_object_terms( $post->ID, $taxonomies );
-
-		foreach ( (array) $terms as $term ) {
-			echo "\t\t<category domain=\"{$term->taxonomy}\" nicename=\"{$term->slug}\">" . wxr_cdata( $term->name ) . "</category>\n";
-		}
-	}
-
-	/**
-	 *
-	 * @param bool   $return_me
-	 * @param string $meta_key
-	 * @return bool
-	 */
-	function wxr_filter_postmeta( $return_me, $meta_key ) {
-		if ( '_edit_lock' == $meta_key )
-			$return_me = true;
-		return $return_me;
-	}
 	add_filter( 'wxr_export_skip_postmeta', 'wxr_filter_postmeta', 10, 2 );
 
 	echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . "\" ?>\n";
@@ -591,3 +355,240 @@ function export_wp( $args = array() ) {
 </rss>
 <?php
 }
+
+/**
+ * Wrap given string in XML CDATA tag.
+ *
+ * @since 2.1.0
+ *
+ * @param string $str String to wrap in XML CDATA tag.
+ * @return string
+ */
+function wxr_cdata( $str ) {
+	if ( ! seems_utf8( $str ) ) {
+		$str = utf8_encode( $str );
+	}
+	// $str = ent2ncr(esc_html($str));
+	$str = '<![CDATA[' . str_replace( ']]>', ']]]]><![CDATA[>', $str ) . ']]>';
+
+	return $str;
+}
+
+/**
+ * Return the URL of the site
+ *
+ * @since 2.5.0
+ *
+ * @return string Site URL.
+ */
+function wxr_site_url() {
+	// Multisite: the base URL.
+	if ( is_multisite() )
+		return network_home_url();
+	// WordPress (single site): the blog URL.
+	else
+		return get_bloginfo_rss( 'url' );
+}
+
+/**
+ * Output a cat_name XML tag from a given category object
+ *
+ * @since 2.1.0
+ *
+ * @param object $category Category Object
+ */
+function wxr_cat_name( $category ) {
+	if ( empty( $category->name ) )
+		return;
+
+	echo '<wp:cat_name>' . wxr_cdata( $category->name ) . "</wp:cat_name>\n";
+}
+
+/**
+ * Output a category_description XML tag from a given category object
+ *
+ * @since 2.1.0
+ *
+ * @param object $category Category Object
+ */
+function wxr_category_description( $category ) {
+	if ( empty( $category->description ) )
+		return;
+
+	echo '<wp:category_description>' . wxr_cdata( $category->description ) . "</wp:category_description>\n";
+}
+
+/**
+ * Output a tag_name XML tag from a given tag object
+ *
+ * @since 2.3.0
+ *
+ * @param object $tag Tag Object
+ */
+function wxr_tag_name( $tag ) {
+	if ( empty( $tag->name ) )
+		return;
+
+	echo '<wp:tag_name>' . wxr_cdata( $tag->name ) . "</wp:tag_name>\n";
+}
+
+/**
+ * Output a tag_description XML tag from a given tag object
+ *
+ * @since 2.3.0
+ *
+ * @param object $tag Tag Object
+ */
+function wxr_tag_description( $tag ) {
+	if ( empty( $tag->description ) )
+		return;
+
+	echo '<wp:tag_description>' . wxr_cdata( $tag->description ) . "</wp:tag_description>\n";
+}
+
+/**
+ * Output a term_name XML tag from a given term object
+ *
+ * @since 2.9.0
+ *
+ * @param object $term Term Object
+ */
+function wxr_term_name( $term ) {
+	if ( empty( $term->name ) )
+		return;
+
+	echo '<wp:term_name>' . wxr_cdata( $term->name ) . "</wp:term_name>\n";
+}
+
+/**
+ * Output a term_description XML tag from a given term object
+ *
+ * @since 2.9.0
+ *
+ * @param object $term Term Object
+ */
+function wxr_term_description( $term ) {
+	if ( empty( $term->description ) )
+		return;
+
+	echo "\t\t<wp:term_description>" . wxr_cdata( $term->description ) . "</wp:term_description>\n";
+}
+
+/**
+ * Output termmeta XML tags for a given term object.
+ *
+ * @since 4.6.0
+ *
+ * @param WP_Term $term Term object.
+ */
+function wxr_term_meta( $term ) {
+	global $wpdb;
+
+	$termmeta = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->termmeta WHERE term_id = %d", $term->term_id ) );
+
+	foreach ( $termmeta as $meta ) {
+		/**
+		 * Filters whether to selectively skip term meta used for WXR exports.
+		 *
+		 * Returning a truthy value to the filter will skip the current meta
+		 * object from being exported.
+		 *
+		 * @since 4.6.0
+		 *
+		 * @param bool   $skip     Whether to skip the current piece of term meta. Default false.
+		 * @param string $meta_key Current meta key.
+		 * @param object $meta     Current meta object.
+		 */
+		if ( ! apply_filters( 'wxr_export_skip_termmeta', false, $meta->meta_key, $meta ) ) {
+			printf( "\t\t<wp:termmeta>\n\t\t\t<wp:meta_key>%s</wp:meta_key>\n\t\t\t<wp:meta_value>%s</wp:meta_value>\n\t\t</wp:termmeta>\n", wxr_cdata( $meta->meta_key ), wxr_cdata( $meta->meta_value ) );
+		}
+	}
+}
+
+/**
+ * Output list of authors with posts
+ *
+ * @since 3.1.0
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @param array $post_ids Array of post IDs to filter the query by. Optional.
+ */
+function wxr_authors_list( array $post_ids = null ) {
+	global $wpdb;
+
+	if ( !empty( $post_ids ) ) {
+		$post_ids = array_map( 'absint', $post_ids );
+		$and = 'AND ID IN ( ' . implode( ', ', $post_ids ) . ')';
+	} else {
+		$and = '';
+	}
+
+	$authors = array();
+	$results = $wpdb->get_results( "SELECT DISTINCT post_author FROM $wpdb->posts WHERE post_status != 'auto-draft' $and" );
+	foreach ( (array) $results as $result )
+		$authors[] = get_userdata( $result->post_author );
+
+	$authors = array_filter( $authors );
+
+	foreach ( $authors as $author ) {
+		echo "\t<wp:author>";
+		echo '<wp:author_id>' . intval( $author->ID ) . '</wp:author_id>';
+		echo '<wp:author_login>' . wxr_cdata( $author->user_login ) . '</wp:author_login>';
+		echo '<wp:author_email>' . wxr_cdata( $author->user_email ) . '</wp:author_email>';
+		echo '<wp:author_display_name>' . wxr_cdata( $author->display_name ) . '</wp:author_display_name>';
+		echo '<wp:author_first_name>' . wxr_cdata( $author->first_name ) . '</wp:author_first_name>';
+		echo '<wp:author_last_name>' . wxr_cdata( $author->last_name ) . '</wp:author_last_name>';
+		echo "</wp:author>\n";
+	}
+}
+
+/**
+ * Ouput all navigation menu terms
+ *
+ * @since 3.1.0
+ */
+function wxr_nav_menu_terms() {
+	$nav_menus = wp_get_nav_menus();
+	if ( empty( $nav_menus ) || ! is_array( $nav_menus ) )
+		return;
+
+	foreach ( $nav_menus as $menu ) {
+		echo "\t<wp:term>";
+		echo '<wp:term_id>' . intval( $menu->term_id ) . '</wp:term_id>';
+		echo '<wp:term_taxonomy>nav_menu</wp:term_taxonomy>';
+		echo '<wp:term_slug>' . wxr_cdata( $menu->slug ) . '</wp:term_slug>';
+		wxr_term_name( $menu );
+		echo "</wp:term>\n";
+	}
+}
+
+/**
+ * Output list of taxonomy terms, in XML tag format, associated with a post
+ *
+ * @since 2.3.0
+ */
+function wxr_post_taxonomy() {
+	$post = get_post();
+
+	$taxonomies = get_object_taxonomies( $post->post_type );
+	if ( empty( $taxonomies ) )
+		return;
+	$terms = wp_get_object_terms( $post->ID, $taxonomies );
+
+	foreach ( (array) $terms as $term ) {
+		echo "\t\t<category domain=\"{$term->taxonomy}\" nicename=\"{$term->slug}\">" . wxr_cdata( $term->name ) . "</category>\n";
+	}
+}
+
+/**
+ *
+ * @param bool   $return_me
+ * @param string $meta_key
+ * @return bool
+ */
+function wxr_filter_postmeta( $return_me, $meta_key ) {
+	if ( '_edit_lock' == $meta_key )
+		$return_me = true;
+	return $return_me;
+}
\ No newline at end of file
diff --git src/wp-includes/comment-template.php src/wp-includes/comment-template.php
index 41accc9..ec7070c 100644
--- src/wp-includes/comment-template.php
+++ src/wp-includes/comment-template.php
@@ -1168,9 +1168,9 @@ function trackback_rdf( $deprecated = '' ) {
  */
 function comments_open( $post_id = null ) {
 
-	$_post = get_post($post_id);
+	$_post = get_post( $post_id );
 
-	$open = ( 'open' == $_post->comment_status );
+	$open = ( $_post && isset( $_post->comment_status ) && 'open' == $_post->comment_status );
 
 	/**
 	 * Filters whether the current post is open for comments.
diff --git tests/phpunit/tests/export/export-wp.php tests/phpunit/tests/export/export-wp.php
new file mode 100644
index 0000000..9e17c5e
--- /dev/null
+++ tests/phpunit/tests/export/export-wp.php
@@ -0,0 +1,35 @@
+<?php
+
+/**
+ * Test export_wp functionality
+ *
+ * @group export
+ */
+class Tests_Export_Export_Wp extends WP_UnitTestCase {
+	function setUp() {
+		parent::setUp();
+		require_once ABSPATH . '/wp-admin/includes/export.php';
+	}
+
+	/**
+	 * export_wp() shall work when running more than once.
+	 *
+	 * As of ticket #33563 calling `export_wp()` multiple times at one runtime causes WP to die.
+	 * The function has been refactored and should no longer be such a pain.
+	 *
+	 * @see https://core.trac.wordpress.org/ticket/33563
+	 *
+	 * @runInSeparateProcess
+	 */
+	function test_it_can_run_multiple_times() {
+
+		ob_start();
+		export_wp();
+		$export_content = ob_get_clean();
+
+		ob_start();
+		export_wp();
+
+		$this->assertEquals( $export_content, ob_get_clean() );
+	}
+}
\ No newline at end of file
