10up / simple-page-ordering

Order your pages and other hierarchical post types with simple drag and drop right from the standard page list.
https://wordpress.org/plugins/simple-page-ordering/
GNU General Public License v2.0
149 stars 23 forks source link

Disable reordering for CPTs without support for page attributes #96

Closed peterwilsoncc closed 2 years ago

peterwilsoncc commented 2 years ago

Describe the bug

Support for ordering of hierarchical custom post types is indicated by the page-attributes support toggle.

This plugin enables support for all hierarchical post types without regard for the page-attributes setting. https://github.com/10up/simple-page-ordering/blob/c44b8df06e9a6118bcfa4156d5fe70013539a54c/simple-page-ordering.php#L75-L76

To prevent users from setting an order that is ignored by WordPress, this check ought to be replaced with a check for the page attributes support only.

Steps to Reproduce

  1. Disable this plugin
  2. Enable a hierarchical CPT without page-attributes support. I've created a gist with a mini plugin.
  3. Create 20 CPT posts via wp-cli: wp post generate --count=20 --post_type=pwcc_test_type
  4. Edit one of the CPTs in the WP Dashboard
  5. Observe you can't modify the menu position via the page attributes setting
  6. Enable this plugin
  7. Visit the CPTs post list table
  8. Observe you can modify the menu position via drag and drop

Screenshots, screen recording, code snippet

CPT without page attributes support

In editor, the menu position can not be set

Screen Shot 2022-05-11 at 1 23 55 pm

In the post list table, the posts can be dragged and dropped

reorder

Environment information

OS: MacOs 11.6.5 Browser: Firefox Developer Edition 101b

WordPress information

WordPress 6.0 RC1

Code of Conduct