1

Is it possible to combine two filters?

add_filter( 'manage_edit-post_columns', function($columns) {
    $columns['author'] = 'User';
    return $columns;
});

add_filter( 'manage_edit-recipe_columns', function($columns) {
    $columns['author'] = 'User';
    return $columns;
});

I want to rename the 'author' column on all pages with posts; but I don't want to apply it to every single custom post type.

1

As long as the received arguments and the return values are the same, yes, you can combine them.

add_filter( 'manage_edit-post_columns', 'my_columns_callback' );
add_filter( 'manage_edit-recipe_columns', 'my_columns_callback' );
function my_columns_callback( $columns ) {
    $columns['author'] = 'User';
    return $columns;
}
  • Thanks @butlerblog! – Sem Feb 13 at 21:40
  • Not a problem!! – butlerblog Feb 13 at 21:54

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.