Custom Ordering Persists After Changing ‘hierarchical’ to False
-
I’m encountering an issue with the custom ordering functionality for hierarchical content types. The problem occurs when a custom post type (CPT) has ‘hierarchical’ => true initially, and custom ordering is enabled. If I later change the CPT registration to ‘hierarchical’ => false, the custom ordering feature persists in the admin interface, even though the post type is no longer hierarchical.
I believe the “Order” sub-menu and related functionality should be automatically removed when ‘hierarchical’ => false. However, this doesn’t happen currently, which creates confusion and leaves unnecessary functionality enabled for non-hierarchical post types.
Steps to Reproduce:
Register a CPT with ‘hierarchical’ => true.
Enable custom ordering for this CPT.
Change the CPT registration to ‘hierarchical’ => false.
Observe that the custom ordering feature and “Order” sub-menu are still visible in the admin interface.
Expected Behavior:
When ‘hierarchical’ => false is set for a CPT, the custom ordering functionality should be disabled automatically, and the “Order” sub-menu should be removed from the admin interface.
Suggested Solution:
The plugin should dynamically check the ‘hierarchical’ attribute of CPTs on each admin load or when the post type is registered. If ‘hierarchical’ => false, it should:
Remove the “Order” sub-menu for the affected CPT.
Disable any custom ordering logic tied to the post type.
Additional Notes:
This would make the plugin more robust and prevent unnecessary functionality from being displayed or enabled for non-hierarchical post types.
- You must be logged in to reply to this topic.