Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Add content to the WordPress viewpost post overview/list column
<?php
/**
* add_view_post_overview_column_content.
*
* Add content to the viewpost post overview/list column.
*
* @see https://since1979.dev/___/
* @uses get_permalink() https://developer.wordpress.org/reference/functions/get_permalink/
* @uses get_the_ID() https://developer.wordpress.org/reference/functions/get_the_id/
*/
function add_view_post_overview_column_content($column)
{
if ($column !== 'viewpost') {
return;
}
echo '<a href="' . get_permalink(get_the_ID()) . '" target="_blank">View post</a>';
}
/**
* Hook: manage_posts_custom_column.
*
* @uses add_action() https://developer.wordpress.org/reference/functions/add_action/
* @uses manage_posts_custom_column https://developer.wordpress.org/reference/hooks/manage_posts_custom_column/
*/
add_action('manage_posts_custom_column', 'add_view_post_overview_column_content');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.