wpseek.com
WordPress开发者和主题制作者的搜索引擎
wp_admin_bar_edit_site_menu › WordPress Function
Since5.9.0
已弃用n/a
› wp_admin_bar_edit_site_menu ( $wp_admin_bar )
| 参数: |
|
| 定义在: |
|
| 文档: | |
| Change Log: |
|
Adds the "Edit Site" link to the Toolbar.
源码
function wp_admin_bar_edit_site_menu( $wp_admin_bar ) {
global $_wp_current_template_id;
// Don't show if a block theme is not activated.
if ( ! wp_is_block_theme() ) {
return;
}
// Don't show for users who can't edit theme options or when in the admin.
if ( ! current_user_can( 'edit_theme_options' ) || is_admin() ) {
return;
}
$wp_admin_bar->add_node(
array(
'id' => 'site-editor',
'icon' => 'core-admin/brush',
'title' => __( 'Edit Site' ),
'href' => add_query_arg(
array(
'postType' => 'wp_template',
'postId' => $_wp_current_template_id,
'canvas' => 'edit',
),
admin_url( 'site-editor.php' )
),
)
);
}