Make WordPress Core

Changeset 31160


Ignore:
Timestamp:
01/12/2015 04:32:35 AM (10 years ago)
Author:
dd32
Message:

More concise documentation for wp_install_maybe_enable_pretty_permalinks()
See #6481. Props ericlewis.

File:
1 edited

Legend:

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

    r31159 r31160  
    264264
    265265/**
    266  * Enable pretty permalinks if available.
    267  *
    268  * This function will enable pretty permalinks if it can verify they work.
    269  * If all pretty permalinks formats fail to work, WordPress will fall back
    270  * to ugly permalinks by setting an empty permalink structure.
     266 * Enable pretty permalinks.
     267 *
     268 * If after enabling pretty permalinks don't work, fallback to query-string permalinks.
    271269 *
    272270 * @since 4.2.0
     
    277275    global $wp_rewrite;
    278276
    279     // Bail if we alredy have permalinks enabled (Multisite)
     277    // Bail if a permalink structure is already enabled.
    280278    if ( get_option( 'permalink_structure' ) ) {
    281279        return;
     
    283281
    284282    /*
    285      * The Permalink structures which WordPress should attempt to use.
     283     * The Permalink structures to attempt.
     284     *
    286285     * The first is designed for mod_rewrite or nginx rewriting.
    287      * The second is PATHINFO based permalinks offered under configurations
    288      * without rewrites enabled.
     286     *
     287     * The second is PATHINFO-based permalinks for web server configurations
     288     * without a true rewrite module enabled.
    289289     */
    290290    $permalink_structures = array(
     
    294294
    295295    foreach ( (array) $permalink_structures as $permalink_structure ) {
    296         // Set the desired Permalink structure to try
    297296        $wp_rewrite->set_permalink_structure( $permalink_structure );
    298297
     
    303302        $wp_rewrite->flush_rules( true );
    304303
    305         // Test against a real WordPress Post, or if none were created, a Page URI
     304        // Test against a real WordPress Post, or if none were created, a random 404 page.
    306305        $test_url = get_permalink( 1 );
    307306        if ( ! $test_url ) {
     
    310309
    311310        /*
    312          * Send a HEAD request to a random page on the site, and check whether
     311         * Send a request to the site, and check whether
    313312         * the 'x-pingback' header is returned as expected.
     313         *
     314         * Uses wp_remote_get() instead of wp_remote_head() because web servers
     315         * can block head requests.
    314316         */
    315317        $response          = wp_remote_get( $test_url, array( 'timeout' => 5 ) );
     
    323325
    324326    /*
    325      * If it makes it this far, Pretty Permalinks failed to activate.
    326      * Reset and allow the user to select it themselves.
     327     * If it makes it this far, pretty permalinks failed.
     328     * Fallback to query-string permalinks.
    327329     */
    328330    $wp_rewrite->set_permalink_structure( '' );
Note: See TracChangeset for help on using the changeset viewer.