4

When I am using manage_media_columns filter of the WordPress I am getting the fatal error.

This is the code I have added in my functions.php file.

add_filter('manage_media_columns' , 'book_cpt_columns');

function book_cpt_columns($columns) {
    $new_columns = array(
        'publisher' => __('Publisher', 'ThemeName'),
        'book_author' => __('Book Author', 'ThemeName'),
    );

    return array_merge($columns, $new_columns);
}

Error I am getting is "Too few arguments fatal error in Add New Media File page error."

1 Answer 1

2

It looks like the issue is coming because of the conflict of the hooks (manage_media_columns and manage_{$screen->id}_columns) because when we manage_{$screen->id}_columns used for media it becomes manage_media_columns and started conflicting.

The same details are mentioned in the documentation link of the hook.

Link: https://developer.wordpress.org/reference/hooks/manage_screen-id_columns/#more-information

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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