Support Forum
Support › MB Admin Columns › Setting Advanced Attributes for Admin Columns via MB Builder
Hi, I'm having trouble creating an admin column for a custom taxonomy term. Using the docs from:
https://docs.metabox.io/extensions/meta-box-builder/
https://docs.metabox.io/extensions/mb-admin-columns/
The taxonomy term is created manually in my theme (it was created before I started using the MB plugin).
Using the MB Builder to add a custom meta field to the term.
When I add the advanced attribute using the dot notation:
Advanced attribute key: admin_columns.0.position
Advanced attribute value: before name
Advanced attribute key: admin_columns.0.sort
Advanced attribute value: 1
The generated code for the field array looks like:
'fields' => array(
array (
'id' => 'custom_order',
'type' => 'number',
'name' => 'Order',
'step' => 1,
'required' => 1,
'label_description' => 'Specify the order in which the Player Positions will be displayed.',
'admin_columns' =>
array (
0 =>
array (
'position' => 'before name',
'sort' => 1,
),
),
),
),
When I use JSON:
Advanced attribute key: admin_columns
Advanced attribute value: [{"position":"before name","sort":"1"}]
The generated code for the field array looks like:
'fields' => array(
array (
'id' => 'custom_order',
'type' => 'number',
'name' => 'Order',
'step' => 1,
'required' => 1,
'label_description' => 'Specify the order in which the Player Positions will be displayed.',
'admin_columns' =>
array (
0 =>
array (
'position' => 'before name',
'sort' => '1',
),
),
),
),
In both cases the admin_columns array is nested a level too deep. What am I doing wrong?
Thanks in advance.
Well this is embarrasing, I updated the MB and MB AIO plugins and the issue above seems to be sorted now.
I can't find a way to delete this topic. The My topics quick link on the right redirects to the homepage.
Must mention that after updating, the Advanced tab now shows no attributes at all. But when I check the generated code, the admin_columns does appear there. Strange.
I have also found another related issue.
The custom meta field shows correctly in the taxonomy admin table, the title is correct and clickable, the orderby value in the querystring is correct, but sorting still happens by name, and not the custom field.
It is a basic number field, currently with values from 1-6.
Hi,
Thanks for your feedback.
I think in the dot notation, you can simply set:
Advanced attribute key: admin_columns.position
Advanced attribute value: before name
(no '.0' in the key).
Using .0 makes the plugin think it's a multi-dimensional array. Please try again with that.
Regarding the sorting with value from custom table, we're working on that. At the moment search and sort for custom table is not supported.
Thanks for your response. That makes sense, I’ll test.
Regarding the sorting, this specific field is not saved in a custom table. It is a normal meta value.