wordpress - Wordpress 在管理栏中添加快捷方式链接以启用/禁用插件
问题描述
我想添加一个链接以在管理栏中启用和禁用插件。
在代码下面,我想知道它是否是正确的方法。谢谢你
function custom_admin_bar_link( $admin_bar ) {
$admin_bar->add_menu( array(
'id' => 'wp-custom-link',
'title' => 'Custom Item',
'href' => '',
'meta' => array(
'title' => __('Custom'),
),
));
$admin_bar->add_menu( array(
'id' => 'disable-link',
'parent'=> 'wp-custom-link',
'title' => 'Disable Amazon',
'href' => 'https://mydisablelink.com/',
'meta' => array(
'title' => __('Disable Amazon'),
),
));
$admin_bar->add_menu( array(
'id' => 'unable-link',
'parent'=> 'wp-custom-link',
'title' => 'Enable Amazon',
'href' => 'https://mydisablelink.com/',
'meta' => array(
'title' => __('Enable Amazon'),
),
));
}
add_action( 'admin_bar_menu', 'custom_admin_bar_link', 100 );
解决方案
推荐阅读
- django - How can I delete a request.session variable inside the Django HTML template?
- wordpress - 限制对 woocommerce 中面板设置的访问
- python-3.x - 如何在不阻塞主线程的情况下串行执行一堆shell命令?
- python - Python REGEX,重新格式化字符串
- python - 是否可以使用 HTML 表单在 Django 中创建登录?
- html - 将数据从一种形式传递到另一种形式
- mongodb - 嵌套文档上的猫鼬填充行为奇怪
- flutter - 如何使用插件audio_service颤动处理音频通知的onTap?
- .net - Serilog 自定义异常消息
- python - 如何在循环从 Python 中的用户输入接收的数据的帮助下写入 qtableWidget