Php 如何在管理中的媒体库部分隐藏特定图像
如何在管理后端的媒体库中隐藏特定的图像名称 假设我有一个图像名Php 如何在管理中的媒体库部分隐藏特定图像,php,wordpress,Php,Wordpress,如何在管理后端的媒体库中隐藏特定的图像名称 假设我有一个图像名“user\u avatar.jpg”。所以我想在媒体部分隐藏这个特殊的图像,我也使用了下面的钩子,但没有帮助 add_filter( 'ajax_query_attachments_args', 'wpse_hide_cv_media_overlay_view' ); function wpse_hide_cv_media_overlay_view( $args ) { // Bail if this is not the
“user\u avatar.jpg”
。所以我想在媒体部分隐藏这个特殊的图像,我也使用了下面的钩子,但没有帮助
add_filter( 'ajax_query_attachments_args', 'wpse_hide_cv_media_overlay_view' );
function wpse_hide_cv_media_overlay_view( $args ) {
// Bail if this is not the admin area.
if ( ! is_admin() ) {
return;
}
// Modify the query.
$args['meta_query'] = [
[
'key' => 'title here',
'compare' => 'NOT EXISTS',
]
];
return $args;
}
还有别的钩子吗
add_filter( 'ajax_query_attachments_args', 'wpse_hide_cv_media_overlay_view' );
function wpse_hide_cv_media_overlay_view( $args ) {
// Bail if this is not the admin area.
if ( ! is_admin() ) {
return;
}
// Modify the query.
$args['meta_query'] = [
[
'key' => '_wp_attached_file',
'value' => 'user_avatar.jpg',
'compare' => '!=',
]
];
return $args;
}