WordPress.org

Ready to get started?Download WordPress

Forums

Simple Page Ordering
[resolved] How to disable for certain post types? (4 posts)

  1. Austen Blokker
    Member
    Posted 1 year ago #

    Plugin works great! I want to use this for my custom post type only, not for pages or posts. Can I disable drag and drop sorting for pages and posts only?

    http://wordpress.org/extend/plugins/simple-page-ordering/

  2. indextwo
    Member
    Posted 1 year ago #

    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).

  3. John Sundberg
    Member
    Posted 10 months ago #

    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;
    
    	}
  4. Jake Goldman
    10up Engineer
    Plugin Author

    Posted 9 months ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.