[wp-trac] [WordPress Trac] #40436: Custom taxonomy terms order lost under wp-admin/post.php edit action for a custom post type
WordPress Trac
noreply at wordpress.org
Thu Apr 13 10:01:42 UTC 2017
#40436: Custom taxonomy terms order lost under wp-admin/post.php edit action for a
custom post type
----------------------------+-----------------------------
Reporter: solo14000 | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Taxonomy | Version: 4.7
Severity: normal | Keywords:
Focuses: administration |
----------------------------+-----------------------------
Hi,
I have registered a custom taxonomy (for a custom post type) that supports
sorting using the following taxonomy args
{{{#!php
const DEFAULT_ARGS = [
'public' => true, // Make
WP function is_tax() working for this custom taxonomy
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => false,
'show_tagcloud' => false,
'show_in_quick_edit' => true,
'meta_box_cb' => null, // If null
default to WP post_tags_meta_box() in not 'hierarchical' otherwise to
post_categories_meta_box() (see WP meta-boxes.php)
'show_admin_column' => true,
'hierarchical' => false,
// 2017-01-25 Seems not to be necessary anymore
'update_count_callback' => 'My_Query_Admin::cb_update_count_callback',
'query_var' => true, // Make
WP function is_tax() working for this custom taxonomy
'rewrite' => false,
'capabilities' => [],
'sort' => true, // Need
by post terms ordering for M_Post_Type::get_main_term()
(https://core.trac.wordpress.org/ticket/5857)
'_builtin' => false,
];
}}}
I used the following args for registering the custom post type
{{{
// Default custom post type arguments
//
https://codex.wordpress.org/Function_Reference/register_post_type
const DEFAULT_ARGS = [
'description' => '',
'public' => false,
'exclude_from_search' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_nav_menus' => false,
'show_in_menu' => true,
'show_in_admin_bar' => true,
// 'capability_type' => 'post',
// 'capabilities' => [],
// 'map_meta_cap' => false,
'hierarchical' => false,
'supports' => [
'title',
'editor',
'thumbnail',
'custom-fields',
],
'register_meta_box_cb' => null,
'has_archive' => false,
'rewrite' => false,
'permalink_epmask' => EP_PERMALINK,
'query_var' => true,
'can_export' => false,
'delete_with_user' => false,
'show_in_rest' => false,
// 'rest_base' => $post_type,
// 'rest_controller_class' => WP_REST_Posts_Controller,
// '_builtin' => false,
'_edit_link' => 'post.php?post=%d',
];
}}}
Terms order is well respected using
{{{#!php
wp_get_object_terms($post->ID, $taxonomy, ['orderby' => 'term_order']);
}}}
but when editing post under admin panel, order is lost and reverts always
to alphabetical order.
Can anyone confirm that bug or tell me what's wrong for me?
Thanks a lot
--
Ticket URL: <https://core.trac.wordpress.org/ticket/40436>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list