I have a plugin which by default shows extra columns in all columns, not only in that post type. How do I change this code to only show up on this specific plugin page/post type?

function modified_column_register( $columns ) {
$columns['time_range'] = __( 'Display', 'vs' );
$columns['active'] = __('Active', 'vs');
return $columns;
add_filter( 'manage_posts_columns', 'modified_column_register' );

Thank you! I tried adding this without any luck:

$screen = get_current_screen();
if  ( 'visitors' == $screen->post_type ) {

Solved it. Changed to manage_{$post_type}_posts_columns and that made it work!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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