Support Forum
Support › MB Custom Table › Problems with columns when displaying taxonomies
Guys, I'm using the custom table and when I use the taxonomy_advanced it normally saves the taxonomy id in the database, but it doesn't show in the post's listing columns.
Image attached.
https://imgur.com/SVLPsmk
Hello there,
Looking at your screenshot, I see the column Labels display one field value as well. So it could be an issue with other posts and other field values. Can you please share a screen record after you edit the second post and save the changes?
Also, please share the code that creates the custom fields and custom table on your site. If you are using the builder, please refer to the documentation https://docs.metabox.io/extensions/meta-box-builder/#getting-php-code
Hi Peter, in the image the value you see is not circled because I did a test
the value that appears is because I used the 'type' => 'taxonomy', if I use the taxonomy_advanced it does not display in the column, below my code
function ims_home_register_meta_boxes_post_type_changelog( $meta_boxes ) {
global $wpdb;
$meta_boxes[] = array(
'id' => 'default',
'title' => __( 'Information', 'ims-home-i18n' ),
'storage_type' => 'custom_table',
'table' => $wpdb->prefix.'postmeta_changelog',
'post_types' => array( 'changelog' ),
'context' => 'normal',
'priority' => 'high',
'fields' => array(
array(
'id' => 'summary_heading',
'type' => 'heading',
'name' => __( 'Resume', 'ims-home-i18n' ),
),
array(
'id' => 'summary_content',
'type' => 'textarea',
'rows' => 2,
),
array(
'id' => 'heading_description',
'type' => 'heading',
'name' => __( 'Description', 'ims-home-i18n' ),
),
array(
'id' => 'description_content',
'type' => 'textarea',
'rows' => 4,
),
array(
'id' => 'information_heading',
'type' => 'heading',
'name' => __( 'Technical information', 'ims-home-i18n' ),
'desc' => __( 'Technical Information comprises data and items as well as important instructions and guidelines for agents.', 'ims-home-i18n' ),
),
array(
'id' => 'information_content',
'type' => 'textarea',
'rows' => 6,
'clone' => true,
'add_button' => __( 'Add more information', 'ims-home-i18n' ),
),
array(
'id' => 'divider',
'type' => 'divider',
),
array(
'id' => 'taxonomy_label',
'type' => 'taxonomy',
'name' => __( 'Label', 'ims-home-i18n' ),
'desc' => __( 'Select the label and version of the log', 'ims-home-i18n' ),
'taxonomy' => 'changelog_label',
'field_type' => 'select_tree',
//'remove_default' => true,
),
array(
'id' => 'taxonomy_type',
'type' => 'taxonomy_advanced',
'name' => __( 'Type', 'ims-home-i18n' ),
'desc' => __( 'Select the type of the log', 'ims-home-i18n' ),
'taxonomy' => 'changelog_type',
'field_type' => 'select',
'remove_default' => true,
),
array(
'id' => 'taxonomy_status',
'type' => 'taxonomy_advanced',
'name' => __( 'Status', 'ims-home-i18n' ),
'desc' => __( 'Select the status of the log', 'ims-home-i18n' ),
'taxonomy' => 'changelog_status',
'field_type' => 'select',
'remove_default' => true,
),
array(
'id' => 'close_date_time',
'type' => 'datetime',
'name' => __( 'Log close time', 'ims-home-i18n' ),
'desc' => __( 'Log closing date and time.', 'ims-home-i18n' ),
'inline' => false,
'timestamp' => false,
),
),
);
return $meta_boxes;
}
add_filter( 'rwmb_meta_boxes', 'ims_home_register_meta_boxes_post_type_changelog' );
Hello,
Can you please share the code that registers the custom table also? The code above is used to register the custom fields.
Please read more on the documentation https://docs.metabox.io/extensions/mb-custom-table/#using-custom-tables-with-code
Hi Peter, below is my complete code.
just reinforcing I have no problems saving the data in the database.
My only problem is that it doesn't display in the post column when I use taxonomy_advanced
if ( ! class_exists( 'MB_Custom_Table_API' ) ) {
return;
}
global $wpdb;
MB_Custom_Table_API::create( "{$wpdb->prefix}postmeta_changelog", [
'summary_content' => 'LONGTEXT NOT NULL',
'description_content' => 'LONGTEXT NOT NULL',
'information_content' => 'LONGTEXT NOT NULL',
'taxonomy_label' => 'LONGTEXT NOT NULL',
'taxonomy_type' => 'LONGTEXT NOT NULL',
'taxonomy_status' => 'LONGTEXT NOT NULL',
'close_date_time' => 'LONGTEXT NOT NULL',
] );
Hello,
I do not see the admin column registered in your code. It should be like this
array(
'id' => 'taxonomy_type',
'type' => 'taxonomy_advanced',
'name' => __( 'Type', 'ims-home-i18n' ),
'desc' => __( 'Select the type of the log', 'ims-home-i18n' ),
'taxonomy' => 'changelog_type',
'field_type' => 'select',
'remove_default' => true,
'admin_columns' => 'after title', //here
),
Please read more on the documentation https://docs.metabox.io/extensions/mb-admin-columns/