Where can I insert the condition additionally into query for media list.
In a word I want to apply some filter regarding the postmeta table’s meta-value.
I tried to get the value with the following sql. But I didn’t get any change.
I modified the function “prepare_items()” in file wp-admin/includes/class-wp-media-list-table.php.
public function prepare_items() {
global $wp_query, $post_mime_types, $avail_post_mime_types, $mode;
/**
*
* paul lee
*
*/
$q_args = $_REQUEST;
$meta_query = array(
array(
'key' => 'meta_value',
'value' => '%cloudinary%',
'compare' => 'NOT LIKE'
)
);
$q_args['meta_query'] = $meta_query;
list( $post_mime_types, $avail_post_mime_types ) = wp_edit_attachments_query( $q_args );
/*-----------------------------------------------*/
$this->is_trash = isset( $_REQUEST['attachment-filter'] ) && 'trash' === $_REQUEST['attachment-filter'];
$mode = empty( $_REQUEST['mode'] ) ? 'list' : $_REQUEST['mode'];
$this->set_pagination_args( array(
'total_items' => $wp_query->found_posts,
'total_pages' => $wp_query->max_num_pages,
'per_page' => $wp_query->query_vars['posts_per_page'],
) );
}
I am not sure if I think wrong that the meta_query will be applied to postmeta table also.
I want your professional help.
Thanks