qq:83050092

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

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

方法1:

在当前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 );

        }

    }

}



方法2:

在根目录下/wp-includes/class-wp-admin-bar.php文件中541行在 class=''ab-item''之前加入 target=”_blank”





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