Skip to main content
replaced http://wordpress.stackexchange.com/ with https://wordpress.stackexchange.com/
Source Link

The way you are doing this is not correct.

Two possibilities:

###1) Create a Dashboard Widget to display the information

add_action('wp_dashboard_setup', 'wpse_60096_dashboard_widget');

function wpse_60096_dashboard_widget() {
    if( current_user_can( 'activate_plugins' ) )
        wp_add_dashboard_widget( 
            'wpse_60096', 
            'Site Pages', 
            'wpse_60096_add_widget_content'
        );
}

function wpse_60096_add_widget_content() {
    $pages = get_pages();                                  
    foreach ( $pages as $page ) 
        echo $page->post_title . '<br>'; 
}

###2) Register an invisible submenu page

The way you are doing this is not correct.

Two possibilities:

###1) Create a Dashboard Widget to display the information

add_action('wp_dashboard_setup', 'wpse_60096_dashboard_widget');

function wpse_60096_dashboard_widget() {
    if( current_user_can( 'activate_plugins' ) )
        wp_add_dashboard_widget( 
            'wpse_60096', 
            'Site Pages', 
            'wpse_60096_add_widget_content'
        );
}

function wpse_60096_add_widget_content() {
    $pages = get_pages();                                  
    foreach ( $pages as $page ) 
        echo $page->post_title . '<br>'; 
}

###2) Register an invisible submenu page

The way you are doing this is not correct.

Two possibilities:

###1) Create a Dashboard Widget to display the information

add_action('wp_dashboard_setup', 'wpse_60096_dashboard_widget');

function wpse_60096_dashboard_widget() {
    if( current_user_can( 'activate_plugins' ) )
        wp_add_dashboard_widget( 
            'wpse_60096', 
            'Site Pages', 
            'wpse_60096_add_widget_content'
        );
}

function wpse_60096_add_widget_content() {
    $pages = get_pages();                                  
    foreach ( $pages as $page ) 
        echo $page->post_title . '<br>'; 
}

###2) Register an invisible submenu page

Source Link
brasofilo
  • 22.1k
  • 8
  • 69
  • 264

The way you are doing this is not correct.

Two possibilities:

###1) Create a Dashboard Widget to display the information

add_action('wp_dashboard_setup', 'wpse_60096_dashboard_widget');

function wpse_60096_dashboard_widget() {
    if( current_user_can( 'activate_plugins' ) )
        wp_add_dashboard_widget( 
            'wpse_60096', 
            'Site Pages', 
            'wpse_60096_add_widget_content'
        );
}

function wpse_60096_add_widget_content() {
    $pages = get_pages();                                  
    foreach ( $pages as $page ) 
        echo $page->post_title . '<br>'; 
}

###2) Register an invisible submenu page