Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Is there a way to display the page url or permalink instead of the page title on

example.com/wp-admin/edit.php?post_type=page

I am doing some A/B testing and some pages have the same title, but a different URL.

Also I may experiment from time to time with a different title. I know all my pages by URL and would prefer to see this in the list of pages.

share|improve this question

1 Answer 1

Filter 'the_title' on the screen with the list table of your post type.
The pattern for the initial hook is: manage_edit-post_type_name_columns.

Sample code:

// replace 'post' with the post type name you want to catch.
add_filter( 'manage_edit-post_columns', 'wpse_67171_title_to_url' );

/**
 * Replace the default title with its permalink.
 *
 * @param  string $title
 * @param  int $id Post ID
 * @return string
 */
function wpse_67171_title_to_url( $title, $id = 0 )
{
    if ( 'the_title' !== current_filter() )
    {
        add_filter( 'the_title', __FUNCTION__, 10, 2 );
        return $title;
    }
    // strip domain name
    return parse_url( get_permalink( $id ), PHP_URL_PATH );
}

Result:

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.