• Resolved DJABHipHop

    (@pressthemes1)


    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.

    • This topic was modified 1 month, 2 weeks ago by DJABHipHop.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter DJABHipHop

    (@pressthemes1)

    Also when enabling custom ordering for a CPT that has 'hierarchical' => true or 'supports' => ['page-attributes'], everything works as expected initially. However, if the CPT is later updated to 'hierarchical' => false & 'page-attributes' is removed from the 'supports' array, the custom ordering functionality (e.g., the “Order” sub-menu) still persists.

    This seems to happen because the plugin doesn’t re-check the current post type registration parameters after they are changed. Ideally, the plugin should verify these attributes dynamically during each admin load or when the post type is registered.

    Suggested Fix:
    Add logic to ensure that the custom ordering feature is automatically disabled whenever:

    1. 'hierarchical' is set to false, &
    2. 'page-attributes' is no longer in the 'supports' array.

    The “Order” sub-menu and related functionality should only be displayed when these criteria are met. This change would make the plugin’s behavior consistent with the current post type settings.

    Let me know if additional examples or debugging information are needed!

    Plugin Author Bowo

    (@qriouslad)

    @pressthemes1 once a post type / CPT has custom order set, the order is saved in the ‘menu_order’ attribute of the posts, in the wp_posts table. Setting hierarchical to false does not modify those saved values.

    To remove the ‘Order’ submenu and disable the custom order, simply uncheck the post type in the Content Order module settings.

    Thread Starter DJABHipHop

    (@pressthemes1)

    @qriouslad You can’t disable the custom order once

    1. 'hierarchical'?is set to?false, &
    2. 'page-attributes'?is no longer in the?'supports'

    since Content Order module settings relay on

    1. 'hierarchical'?is set to?true, &
    2. 'page-attributes'?being ?'supported' by the CPT

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.