Support » Plugin: Simple Page Ordering » How to disable for certain post types?

Viewing 3 replies - 1 through 3 (of 3 total)
  • I second this. I’d like to completely disable the ability for standard Posts and Pages. I realise they won’t be sorted on the front end without a WP_Query set to order by 'menu_order', but I’d like to remove the ability to drag-&-drop in wp-admin as well, just so the client doesn’t get confused (or carried away).

    John Sundberg

    (@bhwebworks)

    This filter worked for me, as long as the CPTs are hierarchical but don’t have page attributes.

    /**
     * Filter Simple Page Ordering to exclude Pages but include custom post types that are hierarchical but don't have page attributes
     *
     */
    
    	add_filter( 'simple_page_ordering_is_sortable', 'bhww_turn_off_simple_page_ordering_for_pages' );
    
    	function bhww_turn_off_simple_page_ordering_for_pages( $sortable ) {
    
    		$screen = get_current_screen();
    		$post_type = $screen->post_type;
    
    		$sortable = ( ! post_type_supports( $post_type, 'page-attributes' ) && is_post_type_hierarchical( $post_type ) );
    		return $sortable;
    
    	}
    Plugin Author Jake Goldman

    (@jakemgold)

    10up Engineer

    Thanks for jumping in John – the simple_page_ordering_is_sortable filter will indeed let you override (or add) drag and drop sorting capabilities for any post type.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to disable for certain post types?’ is closed to new replies.