0

I have a custom post type called Slide set up:

register_post_type('slide', [
    'labels' => [
        'name' => __('Slide'),
        'singular_name' => __('Slide'),
    ],
    'public' => true,
    'has_archive' => true,
    'capability_type' => 'post',
    'capabilities' => array(
        'create_posts' => false,
    ),
    'map_meta_cap' => true,
    'menu_icon' => 'dashicons-universal-access',
]);

I then have a custom taxonomy for it, called Group:

$groupLabels = [ ... ];
register_taxonomy('Groups', 'slide', ['hierarchical' => true, 'labels' => $groupLabels]);

This works fine - I can create Groups, nest them, and tag a Slide with them. The problem is when I go into the edit page for a Slide ( /wp-admin/post.php?post=202&action=edit ) and select some Groups then save it, the Groups I selected float to the top of the list, out of hierarchy order. The weird thing is if I go to the Quick Edit (while still on the list page) it displays correctly.

Does anyone have ANY idea what's going on? I don't even know where to start looking, and Googling for anything like this just brings back completely unrelated results because it's too specific.

0

After way too much Googling, here's a fix :)

add_filter('wp_terms_checklist_args', function ($args) {
    $args['checked_ontop'] = false;
    return $args;
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.