Support

Account

Home Forums Backend Issues (wp-admin) Reorder ACF Groups (per page basis)

Helping

Reorder ACF Groups (per page basis)

  • Hi there, I was wondering if it is possible to set different Field Groups ordering per page.

    For example, we’ve got a “Video” Field Group – on homepage we want it to be the third Field Group, but on “About us” page we want this field to be the first one (or tenth) field group.

    If we change the order of this field on homepage (using drag and drop in the editor), we also edit the ordering of the field groups on about page.

    Is it possible to set a totally different (separate) ordering per page basis?

    PS Apologies for my English

  • There isn’t any way to do this per page/post of the same post type. It is WP that is remembering and ordering the groups when you move them and it does this on a per/screen basis (post type, taxonomy, etc.). WP stores this value in the _usermeta table with meta_key of meta-box-order_{$screen}. There are no filter hooks available that would allow altering this order directly.

    There might be a way to modify this value.

    WP calls this to get the option

    
    $sorted = get_user_option( "meta-box-order_$page" );
    

    There is a filter in get_user_option()

    
    return apply_filters( "get_user_option_{$option}", $result, $option, $user );
    

    It should be possible to alter the order on the “page” post type with a filter

    
    add_filter('get_user_option_meta-box-order_page', 'YourFunctionName', 10, 3)
    

    Exactly how you you would alter the returned value I couldn’t say without actually building something and testing it.

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

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.