The goal is to show posts with special values of custom field (post meta) in separate tab.
I know how to add new tab, here is a code:
add_action( 'views_edit-post', 'remove_edit_post_views' );
function remove_edit_post_views( $views ) {
$views['pre'] = '<a class="'.$class.'" href="'.admin_url().'edit.php?yourlink">Name of Sort</a>';
return $views;
}
but I have no idea how and where I can filter posts.
Any ideas?
Admin post queries can be filtered just like frontend queries using
pre_get_posts
and checking foris_admin
.