From 6c7a60ffb403aaeac6b999147640e39b7fc52736 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 19 Jul 2016 23:12:32 +0000 Subject: [PATCH] Permalinks: In `wp_install_maybe_enable_pretty_permalinks()`: * Use `get_page_by_path()` instead of a hardcoded ID, which may not always exist. * Remove the "test against a random 404 page" part, which is no longer relevant after [34442]. Fixes #36628. Built from https://develop.svn.wordpress.org/trunk@38109 git-svn-id: http://core.svn.wordpress.org/trunk@38050 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/upgrade.php | 9 +++++---- wp-includes/version.php | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/wp-admin/includes/upgrade.php b/wp-admin/includes/upgrade.php index e99d2642fb..807673a7f0 100644 --- a/wp-admin/includes/upgrade.php +++ b/wp-admin/includes/upgrade.php @@ -320,11 +320,12 @@ function wp_install_maybe_enable_pretty_permalinks() { */ $wp_rewrite->flush_rules( true ); - // Test against a real WordPress Post, or if none were created, a random 404 page. - $test_url = get_permalink( 1 ); + $test_url = ''; - if ( ! $test_url ) { - $test_url = home_url( '/wordpress-check-for-rewrites/' ); + // Test against a real WordPress Post + $first_post = get_page_by_path( sanitize_title( _x( 'hello-world', 'Default post slug' ) ), OBJECT, 'post' ); + if ( $first_post ) { + $test_url = get_permalink( $first_post->ID ); } /* diff --git a/wp-includes/version.php b/wp-includes/version.php index ee6914d420..e4fcc36226 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.6-beta3-38108'; +$wp_version = '4.6-beta3-38109'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.