Support

Account

Home Forums Backend Issues (wp-admin) Field Groups Not Showing Reply To: Field Groups Not Showing

  • I just had exactly the same issue. Thank god I saw this or I would of spent ages trying to figure it out.

    I had to rename my post type order to purchase_order and that fixed problem.

    So weird.

    I wasn’t using Custom Post Type UI plugin, I just had my post type hard coded with this…

    <?php
    class Types {
    
        /**
         * Types constructor.
         * @param null|int $id The Player ID to load
         */
        public function __construct ($id = null) {
    
            if(is_null($id)) {
    
                // on initial theme load, run various actions
                add_action('init', array ($this, 'action_init'));
    
            }
    
        }
    
        /**
         * Method to run on WordPress initialisation
         *
         * @uses init action
         * @see  https://codex.wordpress.org/Plugin_API/Action_Reference/init
         */
        public function action_init () {
    
            // register our post type
            $this->register_post_types();
    
        }
    
        /**
         * Returns an array of order labels available
         * to the labels post type
         *
         * @param null|string $key The specific label to load
         * @return array|string Array of labels or single
         * if key is defined
         */
        public static function order_labels ($key = null) {
    
            // create our array of labels
            $aLabels = array (
                'name'                  => 'Orders',
                'singular_name'         => 'Order',
                'add_new'               => 'Add order',
                'add_new_item'          => 'Add new order',
                'edit_item'             => 'Edit order',
                'new_item'              => 'Create order',
                'view_item'             => 'View order',
                'search_items'          => 'Search orders',
                'not_found'             => 'No orders found',
                'not_found_in_trash'    => 'No orders found in trash',
                'parent_item_colon'     => 'Parent order:',
                'all_items'             => 'All orders',
                'archives'              => 'Order archives',
                'insert_into_item'      => 'Insert within order',
                'uploaded_to_this_item' => 'Uploaded to order',
            );
    
            // check if we are returning a single label
            if(!is_null($key) && array_key_exists($key, $aLabels)) {
                return $aLabels[$key];
            }
    
            // by default return all labels
            return $aLabels;
    
        }
    
        /**
         * Registers post types
         * @return void
         */
        protected function register_post_types () {
    
            // register our field post type product
            register_post_type('order', array (
    
                // define our post type labels
                'label'   => self::order_labels('singular_name'),
                'labels'  => self::order_labels(),
    
                // make post type public queryable
                'public'              => true,
    
                // setup UI preferences
                'show_ui'             => true,
                'show_in_nav_menus'   => true,
                'show_in_menu'        => true,
                'show_in_admin_bar'   => false,
    
                // set our menu position and icon
                'menu_position'       => 50,
                'menu_icon'           => 'dashicons-list-view',
    
                // determine our capabilities & support
                'capability_type'     => 'post',
                'supports'            => array (
                    'title', 'author', 'editor'
                ),
    
                // archiving and linking
                'has_archive'         => false,
                'rewrite'             => array (
                    'slug'            => 'order',
                    'with_front'      => false,
                    'feeds'           => false,
                    'pages'           => false,
                    'ep_mask'         => EP_PERMALINK,
                ),
    
            ));
    
        }
    
    } new Types();