Great plugin
-
Works like a charm and beautifully integrated in ACF. Great job. I hope it won’t get abandoned ??
-
Thank you for your feedback!
I don’t have any plans for abandoning the plugin… ??
Good to know.
I did ran into some issues after posting this review. Most field types throw a fatal error when their output is set to ‘object’ in ACF.
Besides that, it would also be a great addition to be able to choose which node/value in the object to show in the column. This is especially handy in relationship type fields that return id’s. Seeing a name or title in stead of that id makes much more sense.
Hi @fromb ,
thanks for your feedback. For which exact field types do you get an error when the output is set to object? What is the error message?
Choosing a node value requires a more complex UI element in the ACF field configuration. I might add something like this in the future. However for now the easiest and quickest way is using the filter ‘acf/admin_columns/render_output’ like so:
// output the slug instead:
function show_slug_field_for_post_objects($rendered_output, $field_properties, $field_value, $post_id) {
if ($field_properties['name'] == 'my_post_object_field') {
if (!empty($field_value[0]) && $field_value[0] instanceof \WP_Post) { // fields returning "object" return an array with an WP_Post object as the only item
return $field_value[0]->post_name;
}
}
return $rendered_output;
}
add_filter('acf/admin_columns/render_output','show_slug_field_for_post_objects', 10, 4);For instance the ‘Taxonomy Terms’ field. If ‘Return Value’ is set to ‘Term object’ in stead of name or id this fatal error occurs on edit.php:
An error of type E_ERROR was caused in line 648 of the file /x/wp-content/plugins/admin-columns-for-acf-fields/acf_admin_columns.php. Error message: Uncaught Error: Object of class WP_Term could not be converted to string in /x/wp-content/plugins/admin-columns-for-acf-fields/acf_admin_columns.php:648
Stack trace:
#0 /x/wp-content/plugins/admin-columns-for-acf-fields/acf_admin_columns.php(648): implode(', ', Array)
#1 /x/wp-content/plugins/admin-columns-for-acf-fields/acf_admin_columns.php(336): FleiACFAdminColumns->render_column_field(Array)
#2 /x/wp-includes/class-wp-hook.php(324): FleiACFAdminColumns->wp_filter_manage_custom_column('acf_facility_al...', 587)
#3 /x/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
#4 /x/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#5 /x/wp-admin/includes/class-wp-posts-list-table.php(1398): do_action('manage_post_pos...', 'acf_facility_al...', 587)
#6 /x/wp-admin/includes/class-wp-list-table.php(1796): WP_Posts_List_Table->column_default(Object(WP_Post), 'acf_facility_al...')
#7 /x/wp-admin/includes/class-wp-posts-list-table.php(1432): WP_List_Table->single_row_columns(Object(WP_Post))
#8 /x/wp-admin/includes/class-wp-posts-list-table.php(936): WP_Posts_List_Table->single_row(Object(WP_Post), 0)
#9 /x/wp-admin/includes/class-wp-posts-list-table.php(808): WP_Posts_List_Table->_display_rows_hierarchical(Array, 1, 100)
#10 /x/wp-admin/includes/class-wp-list-table.php(1706): WP_Posts_List_Table->display_rows()
#11 /x/wp-admin/includes/class-wp-list-table.php(1633): WP_List_Table->display_rows_or_placeholder()
#12 /x/wp-admin/edit.php(503): WP_List_Table->display()
#13 {main}
thrownI cannot reproduce it on my side. That error should not occur when using the “taxonomy” field as that line of code (#648) should not be reached at all.
It tries to convert array entries to strings if $render_output is an array. But in case of the “taxonomy” field the variable $render_output should never become an array.
I assume this is caused somewhere else… Can you duplicate the field group, deactivate the old one (by choosing another location where it should apply at the bottom) and remove all fields except for the taxonomy field and see if the error still occurs?
- You must be logged in to reply to this review.