Adding Page URL to the Pages Admin Table
I want to add the Page URL as a custom column to the Pages admin table. Here is where I am at with the code. Code is in the theme's functions.php.
function lrh_modify_page_table( $column ) {
$column['lrh_url'] = 'URL';
return $column;
}
add_filter( 'manage_pages_columns', 'lrh_modify_page_table' );
function lrh_modify_page_table_row( $column_name, $post_id ) {
$url = get_permalink( $post_id, true);
switch ($column_name) {
case 'lrh_url' :
echo $url;
break;
default:
}
}
add_action( 'manage_pages_custom_column', 'lrh_modify_page_table_row', 10, 2 );
Right now it is returning the url as http://example.com/%pagename%/. How do I get it to return the actual URL of the page?