Index: wp-admin/includes/post.php =================================================================== --- wp-admin/includes/post.php (revision 21259) +++ wp-admin/includes/post.php (working copy) @@ -1342,3 +1342,37 @@ return $url; } + +/** + * Creates a new page to be set as a front page or a posts page in Reading Settings. + * + * @since 3.5.0 + * @access private + */ +function _create_new_page() { + if ( ! isset( $_POST[ 'page_on_front' ] ) && ! isset( $_POST[ 'page_for_posts' ] ) ) + return; + + if ( 'new' != $_POST[ 'page_on_front' ] && 'new' != $_POST[ 'page_for_posts' ] ) + return; + + $post_type = get_post_type_object( 'page' ); + if ( ! current_user_can( $post_type->cap->edit_posts ) ) + wp_die( __( 'You are not allowed to create pages on this site.' ) ); + + foreach ( array( 'page_on_front', 'page_for_posts' ) as $option ) { + if ( ! isset( $_POST[ $option . '_name' ] ) || 'new' != $_POST[ $option ] ) + continue; + + $page_title = esc_html( stripslashes( $_POST[ $option . '_name' ] ) ); + $page = get_page_by_title( $page_title ); + + if ( $page && 'publish' == $page->post_status ) + $page_id = $page->ID; + else + $page_id = wp_insert_post( array( 'post_title' => $page_title, 'post_type' => 'page', 'post_status' => 'publish' ) ); + + $_POST[ $option ] = $page_id; + } +} +add_action( 'admin_init', '_create_new_page' ); Index: wp-admin/options-reading.php =================================================================== --- wp-admin/options-reading.php (revision 21259) +++ wp-admin/options-reading.php (working copy) @@ -25,22 +25,53 @@ ?> \n"; + $output .= "\t\n"; + $pages = get_pages( $r ); + if ( ! empty( $pages ) ) + $output .= walk_page_dropdown_tree( $pages, 0, $r ); + $output .= "\t\n"; + $output .= "\n"; + + return apply_filters( 'wp_dropdown_pages', $output ); +} + get_current_screen()->add_help_tab( array( 'id' => 'overview', 'title' => __('Overview'), @@ -66,17 +97,9 @@