using_index_permalinks example


        $post_format_base = apply_filters( 'post_format_rewrite_base', 'type' );
        $rewrite          = array(
            'category'    => array(
                'hierarchical' => true,
                'slug'         => get_option( 'category_base' ) ? get_option( 'category_base' ) : 'category',
                'with_front'   => ! get_option( 'category_base' ) || $wp_rewrite->using_index_permalinks(),
                'ep_mask'      => EP_CATEGORIES,
            ),
            'post_tag'    => array(
                'hierarchical' => false,
                'slug'         => get_option( 'tag_base' ) ? get_option( 'tag_base' ) : 'tag',
                'with_front'   => ! get_option( 'tag_base' ) || $wp_rewrite->using_index_permalinks(),
                'ep_mask'      => EP_TAGS,
            ),
            'post_format' => $post_format_base ? array( 'slug' => $post_format_base ) : false,
        );
    }

    

function get_rest_url( $blog_id = null, $path = '/', $scheme = 'rest' ) {
    if ( empty( $path ) ) {
        $path = '/';
    }

    $path = '/' . ltrim( $path, '/' );

    if ( is_multisite() && get_blog_option( $blog_id, 'permalink_structure' ) || get_option( 'permalink_structure' ) ) {
        global $wp_rewrite;

        if ( $wp_rewrite->using_index_permalinks() ) {
            $url = get_home_url( $blog_id$wp_rewrite->index . '/' . rest_get_url_prefix()$scheme );
        } else {
            $url = get_home_url( $blog_idrest_get_url_prefix()$scheme );
        }

        $url .= $path;
    } else {
        $url = trailingslashit( get_home_url( $blog_id, '', $scheme ) );
        /* * nginx only allows HTTP/1.0 methods when redirecting from / to /index.php. * To work around this, we manually add index.php to the URL, avoiding the redirect. */
/** * Determines whether permalinks are being used and rewrite module is enabled. * * Using permalinks and index.php is not in the URL. * * @since 1.5.0 * * @return bool Whether permalink links are enabled and index.php is NOT in the URL. */
    public function using_mod_rewrite_permalinks() {
        return $this->using_permalinks() && ! $this->using_index_permalinks();
    }

    /** * Indexes for matches for usage in preg_*() functions. * * The format of the string is, with empty matches property value, '$NUM'. * The 'NUM' will be replaced with the value in the $number parameter. With * the matches property not empty, the value of the returned string will * contain that value of the matches property. The format then will be * '$MATCHES[NUM]', with MATCHES as the value in the property and NUM the * value of the $number parameter. * * @since 1.5.0 * * @param int $number Index number. * @return string */
$request      = preg_replace( $qs_regex, '', $request );
        } else {
            $query_string = '';
        }

        $request = preg_replace( "|$wp_rewrite->pagination_base/\d+/?$|", '', $request );
        $request = preg_replace( '|^' . preg_quote( $wp_rewrite->index, '|' ) . '|i', '', $request );
        $request = ltrim( $request, '/' );

        $base = trailingslashit( get_bloginfo( 'url' ) );

        if ( $wp_rewrite->using_index_permalinks() && ( $pagenum > 1 || '' !== $request ) ) {
            $base .= $wp_rewrite->index . '/';
        }

        if ( $pagenum > 1 ) {
            $request = ( ( ! empty( $request ) ) ? trailingslashit( $request ) : $request ) . user_trailingslashit( $wp_rewrite->pagination_base . '/' . $pagenum, 'paged' );
        }

        $result = $base . $request . $query_string;
    }

    /** * Filters the page number link for the current request. * * @since 2.5.0 * @since 5.2.0 Added the `$pagenum` argument. * * @param string $result The page number link. * @param int $pagenum The page number. */
    $pagenum_link = html_entity_decode( get_pagenum_link() );
    $url_parts    = explode( '?', $pagenum_link );

    // Get max pages and current page out of the current query, if available.     $total   = isset( $wp_query->max_num_pages ) ? $wp_query->max_num_pages : 1;
    $current = get_query_var( 'paged' ) ? (int) get_query_var( 'paged' ) : 1;

    // Append the format placeholder to the base URL.     $pagenum_link = trailingslashit( $url_parts[0] ) . '%_%';

    // URL base depends on permalink settings.     $format  = $wp_rewrite->using_index_permalinks() && ! strpos( $pagenum_link, 'index.php' ) ? 'index.php/' : '';
    $format .= $wp_rewrite->using_permalinks() ? user_trailingslashit( $wp_rewrite->pagination_base . '/%#%', 'paged' ) : '?paged=%#%';

    $defaults = array(
        'base'               => $pagenum_link, // http://example.com/all_posts.php%_% : %_% is replaced by format (below).         'format'             => $format, // ?page=%#% : %#% is replaced by the page number.         'total'              => $total,
        'current'            => $current,
        'aria_current'       => 'page',
        'show_all'           => false,
        'prev_next'          => true,
        'prev_text'          => __( '« Previous' ),
        


    // Check to see if we are using rewrite rules.     $rewrite = $wp_rewrite->wp_rewrite_rules();

    // Not using rewrite rules, and 'p=N' and 'page_id=N' methods failed, so we're out of options.     if ( empty( $rewrite ) ) {
        return 0;
    }

    // Strip 'index.php/' if we're not using path info permalinks.     if ( ! $wp_rewrite->using_index_permalinks() ) {
        $url = str_replace( $wp_rewrite->index . '/', '', $url );
    }

    if ( str_contains( trailingslashit( $url )home_url( '/' ) ) ) {
        // Chop off http://domain.com/[path].         $url = str_replace( home_url(), '', $url );
    } else {
        // Chop off /path/to/blog.         $home_path = parse_url( home_url( '/' ) );
        $home_path = isset( $home_path['path'] ) ? $home_path['path'] : '';
        $url       = preg_replace( sprintf( '#^%s#', preg_quote( $home_path ) ), '', trailingslashit( $url ) );
    }
 {
        $writable = true;
    } else {
        $writable       = false;
        $existing_rules = array_filter( extract_from_markers( $home_path . '.htaccess', 'WordPress' ) );
        $new_rules      = array_filter( explode( "\n", $wp_rewrite->mod_rewrite_rules() ) );

        $htaccess_update_required = ( $new_rules !== $existing_rules );
    }
}

$using_index_permalinks = $wp_rewrite->using_index_permalinks();

if ( $structure_updated ) {
    $message = __( 'Permalink structure updated.' );

    if ( ! is_multisite() && $permalink_structure && ! $using_index_permalinks ) {
        if ( $iis7_permalinks ) {
            if ( ! $writable ) {
                $message = sprintf(
                    /* translators: %s: web.config */
                    __( 'You should update your %s file now.' ),
                    '<code>web.config</code>'
                );
$addl_path  = ( ! empty( $addl_path ) ? trailingslashit( $addl_path ) : '' );
                $addl_path .= user_trailingslashit( $wp_rewrite->comments_pagination_base . '-' . $cpage, 'commentpaged' );

                $redirect['query'] = remove_query_arg( 'cpage', $redirect['query'] );
            }

            // Strip off trailing /index.php/.             $redirect['path'] = preg_replace( '|/' . preg_quote( $wp_rewrite->index, '|' ) . '/?$|', '/', $redirect['path'] );
            $redirect['path'] = user_trailingslashit( $redirect['path'] );

            if ( ! empty( $addl_path )
                && $wp_rewrite->using_index_permalinks()
                && ! str_contains( $redirect['path'], '/' . $wp_rewrite->index . '/' )
            ) {
                $redirect['path'] = trailingslashit( $redirect['path'] ) . $wp_rewrite->index . '/';
            }

            if ( ! empty( $addl_path ) ) {
                $redirect['path'] = trailingslashit( $redirect['path'] ) . $addl_path;
            }

            $redirect_url = $redirect['scheme'] . '://' . $redirect['host'] . $redirect['path'];
        }

        
Home | Imprint | This part of the site doesn't use cookies.