Custom Fields
Support MB Admin Columns No Admin Columns Showing

  • Creator
  • #15302
    Resolved SLG Marketing

    I’ve tried adding some admin columns to a CPT but they won’t output at all. What am I doing wrong?

     public function generateMetaBox($meta_boxes){
            // General
                'title'=>'General Person Settings',
                'post_types' => 'people',
                'context'    => 'normal',
                'priority'   => 'high',
                'fields'=> array(
                        'name'  =>  'Job Title',
                        'id'    =>  'people_jobtitle',
                        'type'  =>  'text',
                        'desc'=>'TODO: help text',
                        'admin_columns' => 'after title'
                        'name'=>'Year Joined',
                        'desc'=>'TODO: help text',
                        'min'   =>  1980,
                        'max'   =>  date('Y'),
                        'admin_columns' => true,
            return $meta_boxes;
Viewing 3 replies - 11 through 13 (of 13 total)
  • Author
  • #18188
    Anh Tran

    @Aart: do you have fields with the same IDs?


    Sorry for the delay, yes, both fields and metaboxes appear with duplicate ID’s.

    And that seems to be a way to solve this issue: different ID’s for the metaboxes fixes the issue.

    Field ID’s are still identical over multiple metabox-definitions, but that doesn’t seem to matter, does it? It’s because I use the same fields for different CPT’s and I want to use separate classes (one per CPT) to define them. But in the templates, the field ID should ideally be identical.

    Anh Tran

    You’re right.

    Meta boxes’ IDs must be unique as they’re stored in a registry with ID as key.

    Fields for different post types might have the same IDs, as we also use post type as key in the field registry. Of course, unique is better.

Viewing 3 replies - 11 through 13 (of 13 total)
  • You must be logged in to reply to this topic.