Normally, default post
and custom post
type screen could use the following
- manage_{$screen->id}_columns – for custom column header
- manage_posts_custom_column – for custom column data for non-hierarchical post types OR
manage_{$post->post_type}_posts_custom_column – any custom post-types
However, links
is not a post type and the data is in its own database table, different to post table.
While the column header still follows the above filter. For the column data of the list in link manager, the filter is manage_link_custom_column
You may use the following code to do so. The following is tested on theme functions.php and proved to work assumed there is no interference from other plugins and the theme itself.
// add column header
add_filter('manage_link-manager_columns', 'add_columns_to_lm');
function add_columns_to_lm( $columns )
{
$newcolumns = array(
'custom_header' => 'new custom header', // header key => value
);
$columns = array_merge($newcolumns, $columns); // just one of the writing style, it is up to you to change
return $columns;
}
// add column data
add_action('manage_link_custom_column', 'add_column_data_to_lm', 10, 2);
function add_column_data_to_lm( $column, $link_id ) {
// var_dump( $link_id ) // for manipulations
if( $column === 'custom_header' ) { // match the header key which you define the new header
echo 'something inside';
}
}