qq:83050092

WordPress后台点击“查看站点”在新窗口中打开

点击次数:6  更新时间:2024-01-19


在当前WordPress模板函数文件functions.php加入以下代码即可:


add_action( 'admin_bar_menu', 'zhuige_basic_shatel_view', 999 );

function zhuige_basic_shatel_view( $wp_admin_bar ) {

    $all_toolbar_nodes = $wp_admin_bar->get_nodes();

    foreach ( $all_toolbar_nodes as $node ) {

        if(in_array($node->id, ['site-name','view-site'])){

$args = $node;

$args->meta = ['target' => '_blank'];

$wp_admin_bar->add_node( $args );

        }

    }

}




Copyright © 2008-2024 AHYUN.CN All Rights Reserved. 皖ICP备11003929号-6