Home Forums Gutenberg Cannot get field group to appear after editor for CPT


Cannot get field group to appear after editor for CPT

  • Hi Guys,

    I have a field group enabled for “Posts” and for my CPT “Events”.

    It is set to appear after “Normal (after content)”, but it only appears in the correct place on the posts. No matter what I set “position” to, the field group only shows in the sidebar of for my custom post type – I cannot get it to appear below the gutenberg editor at all!

    What am I missing?

  • Hi @jakebwhiteley
    I read the link to your Github issue.
    Is the only real work around for existing custom fields is to duplicate it, copy content and then delete older custom field?

  • The problem you have is that someone has already reordered the boxes. The first thing you need to do is find all of the user meta and delete it.

    I would employ 2 things form here

    1) Disable the boxes from being sorted in the first place. In a custom JS file that loads in the admin I add

    	$(document).ready(function(e) {
    			disabled: true
    		$('.postbox .hndle').css('cursor', 'pointer');

    Then, in case that fails for some reason I add the following which prevents the saving of the order meta, priority of 0 causes my action to fire before the built in WP action.

    // disable saving of metabox order
    add_action('wp_ajax_meta-box-order', 'disable_meta_box_order_save', 0);
    function disable_meta_box_order_save() {
  • Hey @hube2

    Thanks for getting back to me.

    I’m not see sure I understand your suggestion. For me, the Group field boxes are stuck in the RHS column when editing a page. So does WP execute the JS snippet when I’m using WP admin? I thought JS files would only execute when WP is loading my theme.

  • While using the WP admin and you drag a field group, WP makes an AJAX request with the action “meta-box-order”. This causes the built in action on that request to run which saves the order. The ajax action I posted fires before the built in WP action because the priority is set to 0 (zero) and the one for WP is set to 1. The new action prevents both the saving of the meta box order and the internal WP action from firing.

    The only way to get them “unstuck” is to delete the user’s meta box order entries in the DB. There isn’t any real way to fix this without working directly in the DB.

    The code I posted will prevent them being moved in the future. Or I should say, if you add the PHP part then the boxes can be moved but when the page reloads then the boxes will be back where they are supposed to be. If you also implement the JS code then the boxes can never be moved.

Viewing 6 posts - 1 through 6 (of 6 total)

The topic ‘Cannot get field group to appear after editor for CPT’ is closed to new replies.