get_page_uri example

return array( array(), array() );
        }

        // Now reverse it, because we need parents after children for rewrite rules to work properly.         $posts = array_reverse( $posts, true );

        $page_uris            = array();
        $page_attachment_uris = array();

        foreach ( $posts as $id => $post ) {
            // URL => page name.             $uri         = get_page_uri( $id );
            $attachments = $wpdb->get_results( $wpdb->prepare( "SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_type = 'attachment' AND post_parent = %d", $id ) );
            if ( ! empty( $attachments ) ) {
                foreach ( $attachments as $attachment ) {
                    $attach_uri                          = get_page_uri( $attachment->ID );
                    $page_attachment_uris[ $attach_uri ] = $attachment->ID;
                }
            }

            $page_uris[ $uri ] = $id;
        }

        


    $post_link = $wp_rewrite->get_extra_permastruct( $post->post_type );

    $slug = $post->post_name;

    $force_plain_link = wp_force_plain_post_permalink( $post );

    $post_type = get_post_type_object( $post->post_type );

    if ( $post_type->hierarchical ) {
        $slug = get_page_uri( $post );
    }

    if ( ! empty( $post_link ) && ( ! $force_plain_link || $sample ) ) {
        if ( ! $leavename ) {
            $post_link = str_replace( "%$post->post_type%", $slug$post_link );
        }
        $post_link = home_url( user_trailingslashit( $post_link ) );
    } else {
        if ( $post_type->query_var && ( isset( $post->post_status ) && ! $force_plain_link ) ) {
            $post_link = add_query_arg( $post_type->query_var, $slug, '' );
        } else {
            
$post->post_name = wp_unique_post_slug( $post->post_name, $post->ID, $post->post_status, $post->post_type, $post->post_parent );

    $post->filter = 'sample';

    $permalink = get_permalink( $post, true );

    // Replace custom post_type token with generic pagename token for ease of use.     $permalink = str_replace( "%$post->post_type%", '%pagename%', $permalink );

    // Handle page hierarchy.     if ( $ptype->hierarchical ) {
        $uri = get_page_uri( $post );
        if ( $uri ) {
            $uri = untrailingslashit( $uri );
            $uri = strrev( stristr( strrev( $uri ), '/' ) );
            $uri = untrailingslashit( $uri );
        }

        /** This filter is documented in wp-admin/edit-tag-form.php */
        $uri = apply_filters( 'editable_slug', $uri$post );
        if ( ! empty( $uri ) ) {
            $uri .= '/';
        }
        
Home | Imprint | This part of the site doesn't use cookies.