We recently updated to php 8.2 and now seeing an error with this plugin:
Fatal error: Uncaught Error: in_array(): Argument #2 ($haystack) must be of type array, null given
in?/home/stagingwebsite/public_html/wp-content/plugins/wp-taxonomy-order/wp-taxonomy-order.php?on line?112
Warning: Undefined array key “taxonomies”
]]>Hi! I’m not sure if my issue was specific to Elementor or if something changed with WordPress but in order for me to get this plugin to work with Elementor I had to use the code I found here: https://wordpress.stackexchange.com/questions/7440/change-order-of-custom-taxonomy-list
function set_the_terms_in_order ( $terms, $id, $taxonomy ) {
$terms = wp_cache_get( $id, "{$taxonomy}_relationships_sorted" );
if ( false === $terms ) {
$terms = wp_get_object_terms( $id, $taxonomy, array( 'orderby' => 'term_order' ) );
wp_cache_add($id, $terms, $taxonomy . '_relationships_sorted');
}
return $terms;
}
add_filter( 'get_the_terms', 'set_the_terms_in_order' , 10, 4 );
function do_the_terms_in_order () {
global $wp_taxonomies; //fixed missing semicolon
// the following relates to tags, but you can add more lines like this for any taxonomy
$wp_taxonomies['post_tag']->sort = true;
$wp_taxonomies['post_tag']->args = array( 'orderby' => 'term_order' );
}
add_action( 'init', 'do_the_terms_in_order');
]]>
Hi,
I just installed the fresh new 1.0.5 version, and it doesn’t seem to work. (with WP 6.0.3). When I drag & drop the category, it takes immediately its original order back.
Thanks for this plugin.
I have a question, why the settings is shown to the editors?
How can I keep the settings menu only for admins?
Thanks
]]>Hi NuttTaro,
thank you for your awesome and perfectly working plug-in. I totally agree with others that this should be core functionality. ??
I have one idea for an improvement that I would appreciate: Right now, the “Taxonomy Order” admin menu item is displayed at the top level of the admin menu. Since the settings of your plugin don’t need frequent change, I feel the menu item should be positioned a bit more subtile (for example as a sub menu item of the default “Settings” item). Otherwise, the menu gets too crowded in complex projects with a lot of custom post types.
Thank you,
Adrian