How to update custom field of a posts in a particular category
Use get_posts to get all the posts in this category, then loop over it and update the post meta for every post. <?php //get_posts uses same parameters as WP_Query hence using ‘category_name’ $tut_posts = get_posts(array(‘category_name’=>’tution’, ‘post_status’=>’publish’)); $url = //some youtube video url here if(!empty($tut_posts)){ foreach($tut_posts as $tut_post){ update_post_meta($tut_post->ID, ‘video’, $url); } } Please check if … Read more