Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I can't seem to figure out how to change the default view for "Pages" in the admin menu.

The initial view is the "Pages" view (/wp-admin/edit.php?post_type=page)

How could it change this to something else?
Like "Add New Page"? (/wp-admin/post-new.php?post_type=page)

I've tried several different options including rebuilding the menu with a custom menu, but it seems like WordPress automatically keeps redirecting the "Pages" view (/wp-admin/edit.php?post_type=page).

share|improve this question
    
Why would you change the default view? There's already an "Add new page" page. Where would you list the pages then? –  developdaly Apr 13 '12 at 15:22
    
Im actually using a page order plugin that creates a new sub item to re-order pages. That is what I want to be the default page, but I cannot change it to anything. I would then hide the all pages view. Follow me? –  Shae Apr 13 '12 at 15:26
    
I've created a custom menu that will point here: edit.php?post_type=page&page=custom_page_order but it redirects to the Posts reorder instead of pages. –  Shae Apr 13 '12 at 15:29

3 Answers 3

[Update]
Answer rewritten, based on this other Q&A.


To achieve this:

default pages menu view

Use this code:

add_filter( 'custom_menu_order', 'wpse_48933_submenu_order' );

function wpse_48933_submenu_order( $menu_ord ) 
{
    global $submenu;

    // Enable the next line to inspect the $submenu values
    // echo '<pre>'.print_r($submenu,true).'</pre>';

    $arr = array();
    $arr[] = $submenu['edit.php?post_type=page'][10];
    $arr[] = $submenu['edit.php?post_type=page'][5];
    $submenu['edit.php?post_type=page'] = $arr;

    return $menu_ord;
}
share|improve this answer

In a custom plugin, use this PHP to remove the Pages page.

add_action( 'admin_menu', 'my_custom_pages' );

function my_custom_pages() {
    remove_menu_page('edit.php?post_type=page'); // Pages
            add_menu_page('Pages', 'Pages', 'author', 'pages', 'my_custom_menu_page' );
}

function my_custom_menu_page() {
    // The function to load your new page
}

This will need customizing, but it takes care of removing the original and replacing it with yours.

share|improve this answer
    
Ok, so I have a custom Menu, the Parent Menu item is pointing here:edit.php?post_type=page&page=edit.php?post_type=page&page=custom_page_order But it is redirecting to Post order, not pages. The fist sub menu item has the same exact link:edit.php?post_type=page&page=edit.php?post_type=page&page=custom_page_order It works properly, it goes to the Pages order –  Shae Apr 13 '12 at 15:43

A different way of doing this is to add your custom query variable into the loading of the page.

add_action('pre_get_posts', 'my_custom_query_vars' );
function my_custom_query_vars() {
    $screen = get_current_screen();
    if ( $screen->id == 'edit-page' ) {
        set_query_var( 'orderby', 'custom_page_order' );
    }
}
share|improve this answer
    
I'm not sure I follow how this is supposed to work? –  Shae Apr 13 '12 at 17:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.