自定义管理页面-Wordpress

时间:2019-01-02 13:15:39

标签: wordpress dashboard

我正在创建管理员(WordPress)自定义页面,以在其中添加一些信息:教程,链接等。但是我可以将其设置为默认页面吗?我的意思是登录后开始页面?我的功能如下:

add_action( 'admin_menu', 'register_testpage' );

function register_testpage(){
add_dashboard_page( 'Hello bro!', 'Welcome', 'manage_options', 'backend',     'testpage', plugins_url( 'testpage/images/icon.png' ), 6 ); 
}


function testpage(){
echo '<div class="wrap"><div id="icon-tools" class="icon1"></div>';
    echo '<h2>Hello!</h2>';
    echo 'Info here...';

echo '</div>';
}

1 个答案:

答案 0 :(得分:0)

/* Redirect the user logging in to a custom admin page. */



    function new_dashboard_home($username, $user){
        if(array_key_exists('administrator', $user->caps)){
            wp_redirect(admin_url('admin.php?page=c2c-overview', 'http'), 301);
            exit;
      }}
add_action('wp_login', 'new_dashboard_home', 10, 2);
相关问题