media\\u upload\\u tabs筛选器传递一个包含选项卡数组的参数,您可以通过unset()将其删除。
数组如下所示:
Array
(
[type] => From Computer
[type_url] => From URL
[gallery] => Gallery
[library] => Media Library
)
要删除“媒体库”选项卡,请执行以下操作:
function remove_media_library_tab($tabs) {
unset($tabs[\'library\']);
return $tabs;
}
add_filter(\'media_upload_tabs\', \'remove_media_library_tab\');
如果只想在某些post或post\\u类型上隐藏它,可以检查$\\u请求或$\\u GET参数。使用“上载/插入”链接时,会传递多个数据点:
/wp-admin/media-upload.php?post_id=28506&type=image&TB_iframe=1&width=640&height=581
function remove_media_library_tab($tabs) {
if (isset($_REQUEST[\'post_id\'])) {
$post_type = get_post_type($_REQUEST[\'post_id]);
if (\'post\' == $post_type)
unset($tabs[\'library\']);
}
return $tabs;
}
add_filter(\'media_upload_tabs\', \'remove_media_library_tab\');
希望有帮助