user_trailingslashit example


function get_post_embed_url( $post = null ) {
    $post = get_post( $post );

    if ( ! $post ) {
        return false;
    }

    $embed_url     = trailingslashit( get_permalink( $post ) ) . user_trailingslashit( 'embed' );
    $path_conflict = get_page_by_path( str_replace( home_url(), '', $embed_url ), OBJECT, get_post_types( array( 'public' => true ) ) );

    if ( ! get_option( 'permalink_structure' ) || $path_conflict ) {
        $embed_url = add_query_arg( array( 'embed' => 'true' )get_permalink( $post ) );
    }

    /** * Filters the URL to embed a specific post. * * @since 4.4.0 * * @param string $embed_url The post embed URL. * @param WP_Post $post The corresponding post object. */
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() ) {
        $comment_link = user_trailingslashit( $comment_link, 'comment' );
    }

    $comment_link = $comment_link . '#comment-' . $comment->comment_ID;

    
function _wp_link_page( $i ) {
    global $wp_rewrite;
    $post       = get_post();
    $query_args = array();

    if ( 1 == $i ) {
        $url = get_permalink();
    } else {
        if ( ! get_option( 'permalink_structure' ) || in_array( $post->post_status, array( 'draft', 'pending' ), true ) ) {
            $url = add_query_arg( 'page', $iget_permalink() );
        } elseif ( 'page' === get_option( 'show_on_front' ) && get_option( 'page_on_front' ) == $post->ID ) {
            $url = trailingslashit( get_permalink() ) . user_trailingslashit( "$wp_rewrite->pagination_base/" . $i, 'single_paged' );
        } else {
            $url = trailingslashit( get_permalink() ) . user_trailingslashit( $i, 'single_paged' );
        }
    }

    if ( is_preview() ) {

        if ( ( 'draft' !== $post->post_status ) && isset( $_GET['preview_id']$_GET['preview_nonce'] ) ) {
            $query_args['preview_id']    = wp_unslash( $_GET['preview_id'] );
            $query_args['preview_nonce'] = wp_unslash( $_GET['preview_nonce'] );
        }

        
$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' ),
        'next_text'          => __( 'Next »' ),
        
if ( empty( $link ) ) {
        $file = home_url( '/' );
        $link = $file . '?author=' . $author_id;
    } else {
        if ( '' === $author_nicename ) {
            $user = get_userdata( $author_id );
            if ( ! empty( $user->user_nicename ) ) {
                $author_nicename = $user->user_nicename;
            }
        }
        $link = str_replace( '%author%', $author_nicename$link );
        $link = home_url( user_trailingslashit( $link ) );
    }

    /** * Filters the URL to the author's page. * * @since 2.1.0 * * @param string $link The URL to the author's page. * @param int $author_id The author's ID. * @param string $author_nicename The author's nice name. */
    

        $id = apply_filters( 'old_slug_redirect_post_id', $id );

        if ( ! $id ) {
            return;
        }

        $link = get_permalink( $id );

        if ( get_query_var( 'paged' ) > 1 ) {
            $link = user_trailingslashit( trailingslashit( $link ) . 'page/' . get_query_var( 'paged' ) );
        } elseif ( is_embed() ) {
            $link = user_trailingslashit( trailingslashit( $link ) . 'embed' );
        }

        /** * Filters the old slug redirect URL. * * @since 4.4.0 * * @param string $link The redirect URL. */
        
$ancestors          = get_ancestors( $term->term_id, $taxonomy, 'taxonomy' );
            foreach ( (array) $ancestors as $ancestor ) {
                $ancestor_term        = get_term( $ancestor$taxonomy );
                $hierarchical_slugs[] = $ancestor_term->slug;
            }
            $hierarchical_slugs   = array_reverse( $hierarchical_slugs );
            $hierarchical_slugs[] = $slug;
            $termlink             = str_replace( "%$taxonomy%", implode( '/', $hierarchical_slugs )$termlink );
        } else {
            $termlink = str_replace( "%$taxonomy%", $slug$termlink );
        }
        $termlink = home_url( user_trailingslashit( $termlink, 'category' ) );
    }

    // Back compat filters.     if ( 'post_tag' === $taxonomy ) {

        /** * Filters the tag link. * * @since 2.3.0 * @since 2.5.0 Deprecated in favor of {@see 'term_link'} filter. * @since 5.4.1 Restored (un-deprecated). * * @param string $termlink Tag link URL. * @param int $term_id Term ID. */
$page = get_query_var( 'page' );

            if ( ! $redirect_url ) {
                $redirect_url = get_permalink( get_queried_object_id() );
                $redirect_obj = get_post( get_queried_object_id() );
            }

            if ( $page > 1 ) {
                $redirect_url = trailingslashit( $redirect_url );

                if ( is_front_page() ) {
                    $redirect_url .= user_trailingslashit( "$wp_rewrite->pagination_base/$page", 'paged' );
                } else {
                    $redirect_url .= user_trailingslashit( $page, 'single_paged' );
                }
            }

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

        if ( get_query_var( 'sitemap' ) ) {
            $redirect_url      = get_sitemap_url( get_query_var( 'sitemap' )get_query_var( 'sitemap-subtype' )get_query_var( 'paged' ) );
            $redirect['query'] = remove_query_arg( array( 'sitemap', 'sitemap-subtype', 'paged' )$redirect['query'] );
        }
$date[3],
            $date[4],
            $date[5],
            $post->post_name,
            $post->ID,
            $category,
            $author,
            $post->post_name,
        );

        $permalink = home_url( str_replace( $rewritecode$rewritereplace$permalink ) );
        $permalink = user_trailingslashit( $permalink, 'single' );

    } else { // If they're not using the fancy permalink option.         $permalink = home_url( '?p=' . $post->ID );
    }

    /** * Filters the permalink for a post. * * Only applies to posts with post_type of 'post'. * * @since 1.5.0 * * @param string $permalink The post's permalink. * @param WP_Post $post The post in question. * @param bool $leavename Whether to keep the post name. */
/** * Get site index relational link. * * @since 2.8.0 * @deprecated 3.3.0 * * @return string */
function get_index_rel_link() {
    _deprecated_function( __FUNCTION__, '3.3.0' );

    $link = "<link rel='index' title='" . esc_attr( get_bloginfo( 'name', 'display' ) ) . "' href='" . esc_url( user_trailingslashit( get_bloginfo( 'url', 'display' ) ) ) . "' />\n";
    return apply_filters( "index_rel_link", $link );
}

/** * Display relational link for the site index. * * @since 2.8.0 * @deprecated 3.3.0 */
function index_rel_link() {
    _deprecated_function( __FUNCTION__, '3.3.0' );

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