admin管理员组

文章数量:1122846

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."

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."

Share Improve this question edited Jul 9, 2024 at 7:07 fuxia 107k38 gold badges255 silver badges459 bronze badges asked Jul 9, 2024 at 5:09 Ashok KumarAshok Kumar 433 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 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

本文标签: hooksGetting fatal error when using managemediacolumns filter of WordPress