From 0e236b6e727bf1dcbad5c1ff7885594317eef9a5 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sun, 5 Apr 2015 14:48:23 +0000 Subject: [PATCH] `wp_install_maybe_enable_pretty_permalinks()` should have a consistent `@return` value. props DrewAPicture. fixes #6481. see #31888. git-svn-id: https://develop.svn.wordpress.org/trunk@32027 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/upgrade.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/wp-admin/includes/upgrade.php b/src/wp-admin/includes/upgrade.php index 13988383c1..330cfad8e9 100644 --- a/src/wp-admin/includes/upgrade.php +++ b/src/wp-admin/includes/upgrade.php @@ -265,20 +265,22 @@ As a new WordPress user, you should go to your dashboard to d endif; /** - * Enable pretty permalinks. + * Maybe enable pretty permalinks on install. * * If after enabling pretty permalinks don't work, fallback to query-string permalinks. * * @since 4.2.0 * * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + * + * @return bool Whether pretty permalinks are enabled. False otherwise. */ function wp_install_maybe_enable_pretty_permalinks() { global $wp_rewrite; // Bail if a permalink structure is already enabled. if ( get_option( 'permalink_structure' ) ) { - return; + return true; } /* @@ -305,6 +307,7 @@ function wp_install_maybe_enable_pretty_permalinks() { // Test against a real WordPress Post, or if none were created, a random 404 page. $test_url = get_permalink( 1 ); + if ( ! $test_url ) { $test_url = home_url( '/wordpress-check-for-rewrites/' ); } @@ -331,6 +334,8 @@ function wp_install_maybe_enable_pretty_permalinks() { */ $wp_rewrite->set_permalink_structure( '' ); $wp_rewrite->flush_rules( true ); + + return false; } if ( !function_exists('wp_new_blog_notification') ) :