Support

Search results for ""

Sorry, no results found. Perhaps you would like to search the documentation?
All Topics
fragenicht

Fatal Error -cannot access protected method class@anonymous::admin_column()

In one of my sites I get the following error:

Uncaught TypeError: call_user_func_array(): Argument #1 ($callback) must be a valid callback, cannot access protected method class@anonymous::admin_column()Stack trace: #0 /wp-includes/plugin.php(205): WP_Hook->apply_filters() #1 /wp-content/plugins/admin-columns-pro/admin-columns/classes/Table/ManageValue.php(50): apply_filters() #2 /wp-content/plugins/admin-columns-pro/admin-columns/classes/Table/ManageValue/Post.php(39): AC\Table\ManageValue->render_cell() #3 /wp-includes/class-wp-hook.php(324): AC\Table\ManageValue\Post->render_value() #4 /wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() #5 /wp-includes/plugin.php(517): WP_Hook->do_action() #6 /wp-admin/includes/class-wp-posts-list-table.php(1398): do_action() #7 /wp-admin/includes/class-wp-list-table.php(1799): WP_Posts_List_Table->column_default() #8 /wp-admin/includes/class-wp-posts-list-table.php(1432): WP_List_Table->single_row_columns() #9 /wp-admin/includes/class-wp-posts-list-table.php(834): WP_Posts_List_Table->single_row() #10 /wp-admin/includes/class-wp-posts-list-table.php(810): WP_Posts_List_Table->_display_rows() #11 /wp-admin/includes/class-wp-list-table.php(1709): WP_Posts_List_Table->display_rows() #12 /wp-admin/includes/class-wp-list-table.php(1636): WP_List_Table->display_rows_or_placeholder() #13 /wp-admin/edit.php(503): WP_List_Table->display() #14 {main} thrown in /wp-includes/class-wp-hook.php on line 324WordPress core
File: /wp-includes/class-wp-hook.php
Line: 324

1 month, 1 week ago
fragenicht

I fixed the Problem.
It was a conflict with “Advanced Custom Fields: ACF Country”

1 month, 1 week ago
Stefan van den Dungen Gronovius
Developer

Thanks for letting me know. I guess they use one of our filters but don’t use it the ‘right’ way. Did you notice those plugin authors about the issue?

1 month, 1 week ago
Tom Jenkins

Hiya

I have the exact same issue with using the ACF country addon and Admin Columns Pro. Looking at their code they are calling a protected function in the plugin file:

add_filter('ac/column/value', [$this, 'admin_column'], 10, 3);

Which calls

protected function admin_column($value, $id, $column)
    {
        if (
            !is_a($column, '\ACA\ACF\Column')
            || $column->get_acf_field_option('type') !== 'country'
        ) {
            return $value;
        }

        return get_field($column->get_meta_key()) ?? $value;
    }

That’s easy enough to change to a public function. It then complains that “Function ACA\ACF\Column::get_acf_field_option is deprecated”. What should be used in its place to get the type of column? I think it’s along the lines of

$column->get_setting('type')

But cannot get it to output anything other than the key. If you could please help I’ll happily put a push request into the plugin author to try and get it resolved.

Thanks

1 month, 1 week ago
Tom Jenkins

Almost as sent that, I managed to get the type using:


$column->get_field()->get_settings()['type']

Is this the best way to get it?

1 month, 1 week ago
Stefan van den Dungen Gronovius
Developer

If you check for the ACF column, you can get the type by doing this:

    if ($column instanceof ACA\ACF\Column) {
        $type = $column->get_field_type();
    }
1 month, 1 week ago
Tom Jenkins

Brilliant, thank you

1 month, 1 week ago
Stefan van den Dungen Gronovius
Developer

You’re welcome. I also noticed that the author of the ACF Country plugin has changed the code in the latest release.

1 month ago

You must be logged in to reply to this topic.