Back to top
Reorder PostsReference

Hooks

You can skip the settings screen and do the same jobs in code. The filters run on the list of types, the admin menu, and the optional query rewrite. Actions are for add-ons that need to hang a tab or a script on the reorder screen.

Which types

metronet_reorder_post_types receives the types that are already enabled in settings. Appending a slug turns that type on without a click.

add_filter( 'metronet_reorder_post_types', function ( $post_types ) {
    $post_types[] = 'portfolio';
    return array_unique( $post_types );
} );

Returning a fresh array replaces the settings list. This is the version that locks the plugin to exactly the types you name.

add_filter( 'metronet_reorder_post_types', function () {
    return array( 'portfolio', 'page' );
} );

metronet_reorder_post_types_loaded fires after that filter, with the final list. Use it if you need to react, not to change the list.

Admin menu

HookRole
metronet_reorder_menu_location_{post_type}Parent menu slug for the Reorder submenu. Not used for posts, which always sit under Posts. Second argument is the post type
metronet_reorder_menu_label_{post_type}Menu label. Defaults to Reorder. For types other than post, the post type is the second argument
metronet_reorder_menu_url_{post_type}Action. Receives the reorder screen URL after the menu is registered
metronet_reorder_posts_add_menu_{post_type}Action. Receives the hook suffix, so an add-on can enqueue scripts on that screen

Tabs on the reorder screen

metronet_reorder_posts_tabs_{post_type} filters the tab list. Each tab is an array with url, label, get (the tab query argument), and action (the hook that prints the panel). The default tab’s action is metronet_reorder_posts_interface_{post_type}. With a single tab the screen does not draw a tab bar. Add a second tab and the bar shows up.

Turn Advanced sorting off in code

metronet_reorder_post_allow_admin defaults to true. Return false and the settings screen, plus both query-rewrite hooks, never load. The reorder screens still register.

metronet_reorder_allow_menu_order kills the rewrite for every type when it returns false. metronet_reorder_allow_menu_order_{post_type} kills it for one type. The settings can still say Menu Order. The filter wins.

add_filter( 'metronet_reorder_allow_menu_order_portfolio', '__return_false' );