I added post_meta 'batch' to 'assignment' custom post as follows:
update_post_meta( $id, 'batch', strip_tags($_POST['batch']));
Now I am trying to retrieve this data as follows:
$args = array(
'post_type' => 'assignment',
'post_status' => 'publish',
);
$assignments = new WP_Query( $args );
I want to get all data having 'batch=2017'. How can I do this?