Can't reset the secondary query by wp_reset_postdata()
In custom post meta I have executed a custom query to get custom meta but when I tried to return to the main $post query, its printing the secondary loop.Where is my custom query and I have reset it by wp_reset_postdata().But no result.
$custom_fields = get_posts( array( 'post_type' = 'custom_field',
'posts_per_page' = -1,
'post_status' = 'publish',
'meta_key' = 'associate',
'meta_value' = 'form'
) );
foreach ($custom_fields as $post) {
setup_postdata($post);
var_dump(get_the_ID());
}
wp_reset_postdata();
wp_reset_query();
Topic wp-reset-postdata wp-query Wordpress
Category Web