php - Wordpress : Fatal error: Uncaught ArgumentCountError: Too few arguments to function posts_custom_columns(), 1 passed in

816

In wordpress getting following error

(Fatal error: Uncaught ArgumentCountError: Too few arguments to function posts_custom_columns(), 1 passed in )

when enabling the featured image in admin list. Here is the code which i have added in functions.php

add_filter('manage_posts_columns', 'posts_columns');
add_action('manage_posts_custom_column', 'posts_custom_columns');
    function posts_columns($defaults){
    $defaults['wdm_post_thumbs'] = __('Featured Image'); //name of the column
    return $defaults;
}
function posts_custom_columns($column_name, $id){
        if($column_name === 'wdm_post_thumbs'){
        echo the_post_thumbnail(array(75,75)); //size of the thumbnail 
    }
}

While removing this no error. I need to know what was wrong with it ?

818

Answer

Solution:

Try changing

add_action('manage_posts_custom_column', 'posts_custom_columns');

to

add_action('manage_posts_custom_column', 'posts_custom_columns', 10, 2);

People are also looking for solutions to the problem: php - How to protect a public image upload folder from manipulation/direct access

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.