Make WordPress Core


Ignore:
Timestamp:
07/19/2016 11:11:25 PM (9 years ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/upgrade.php

    r37985 r38109  
    321321        $wp_rewrite->flush_rules( true );
    322322
    323         // Test against a real WordPress Post, or if none were created, a random 404 page.
    324         $test_url = get_permalink( 1 );
    325 
    326         if ( ! $test_url ) {
    327             $test_url = home_url( '/wordpress-check-for-rewrites/' );
     323        $test_url = '';
     324
     325        // Test against a real WordPress Post
     326        $first_post = get_page_by_path( sanitize_title( _x( 'hello-world', 'Default post slug' ) ), OBJECT, 'post' );
     327        if ( $first_post ) {
     328            $test_url = get_permalink( $first_post->ID );
    328329        }
    329330
Note: See TracChangeset for help on using the changeset viewer.