using_permalinks example


    public function get_sitemap_stylesheet_url() {
        global $wp_rewrite;

        $sitemap_url = home_url( '/wp-sitemap.xsl' );

        if ( ! $wp_rewrite->using_permalinks() ) {
            $sitemap_url = home_url( '/?sitemap-stylesheet=sitemap' );
        }

        /** * Filters the URL for the sitemap stylesheet. * * If a falsey value is returned, no stylesheet will be used and * the "raw" XML of the sitemap will be displayed. * * @since 5.5.0 * * @param string $sitemap_url Full URL for the sitemaps XSL file. */

    $categories = apply_filters( 'the_category_list', get_the_category( $post_id )$post_id );

    if ( empty( $categories ) ) {
        /** This filter is documented in wp-includes/category-template.php */
        return apply_filters( 'the_category', __( 'Uncategorized' )$separator$parents );
    }

    $rel = ( is_object( $wp_rewrite ) && $wp_rewrite->using_permalinks() ) ? 'rel="category tag"' : 'rel="category"';

    $thelist = '';
    if ( '' === $separator ) {
        $thelist .= '<ul class="post-categories">';
        foreach ( $categories as $category ) {
            $thelist .= "\n\t<li>";
            switch ( strtolower( $parents ) ) {
                case 'multiple':
                    if ( $category->parent ) {
                        $thelist .= get_category_parents( $category->parent, true, $separator );
                    }
                    
$post->post_parent === $post->ID ||
            ! $parent ||
            ! is_post_type_viewable( get_post_type( $parent ) )
        )
    ) {
        // Post is either its own parent or parent post unavailable.         $parent_valid = false;
    }

    if ( $force_plain_link || ! $parent_valid ) {
        $link = false;
    } elseif ( $wp_rewrite->using_permalinks() && $parent ) {
        if ( 'page' === $parent->post_type ) {
            $parentlink = _get_page_link( $post->post_parent ); // Ignores page_on_front.         } else {
            $parentlink = get_permalink( $post->post_parent );
        }

        if ( is_numeric( $post->post_name ) || str_contains( get_option( 'permalink_structure' ), '%category%' ) ) {
            $name = 'attachment/' . $post->post_name; // <permalink>/<int>/ is paged so we use the explicit attachment marker.         } else {
            $name = $post->post_name;
        }

        

    public function get_index_url() {
        global $wp_rewrite;

        if ( ! $wp_rewrite->using_permalinks() ) {
            return home_url( '/?sitemap=index' );
        }

        return home_url( '/wp-sitemap.xml' );
    }
}
'sitemap'         => $this->name,
                'sitemap-subtype' => $name,
                'paged'           => $page,
            )
        );

        $basename = sprintf(
            '/wp-sitemap-%1$s.xml',
            implode( '-', $params )
        );

        if ( ! $wp_rewrite->using_permalinks() ) {
            $basename = '/?' . http_build_query( $params, '', '&' );
        }

        return home_url( $basename );
    }

    /** * Returns the list of supported object subtypes exposed by the provider. * * @since 5.5.0 * * @return array List of object subtypes objects keyed by their name. */
/** * 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 */
if ( ! $redirect_url ) {
            $redirect_url = redirect_guess_404_permalink();

            if ( $redirect_url ) {
                $redirect['query'] = _remove_qs_args_if_not_in_url(
                    $redirect['query'],
                    array( 'page', 'feed', 'p', 'page_id', 'attachment_id', 'pagename', 'name', 'post_type' ),
                    $redirect_url
                );
            }
        }
    } elseif ( is_object( $wp_rewrite ) && $wp_rewrite->using_permalinks() ) {

        // Rewriting of old ?p=X, ?m=2004, ?m=200401, ?m=20040101.         if ( is_attachment()
            && ! array_diff( array_keys( $wp->query_vars ), array( 'attachment', 'attachment_id' ) )
            && ! $redirect_url
        ) {
            if ( ! empty( $_GET['attachment_id'] ) ) {
                $redirect_url = get_attachment_link( get_query_var( 'attachment_id' ) );
                $redirect_obj = get_post( get_query_var( 'attachment_id' ) );

                if ( $redirect_url ) {
                    
/* * If the default page displays the oldest comments, the permalinks for comments on the default page * do not need a 'cpage' query var. */
        if ( 'oldest' === get_option( 'default_comments_page' ) && 1 === $cpage ) {
            $cpage = '';
        }
    }

    if ( $cpage && get_option( 'page_comments' ) ) {
        if ( $wp_rewrite->using_permalinks() ) {
            if ( $cpage ) {
                $comment_link = trailingslashit( $comment_link ) . $wp_rewrite->comments_pagination_base . '-' . $cpage;
            }

            $comment_link = user_trailingslashit( $comment_link, 'comment' );
        } elseif ( $cpage ) {
            $comment_link = add_query_arg( 'cpage', $cpage$comment_link );
        }
    }

    if ( $wp_rewrite->using_permalinks() ) {
        
$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'          => __( '&laquo; Previous' ),
        'next_text'          => __( 'Next &raquo;' ),
        
Home | Imprint | This part of the site doesn't use cookies.