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 this works for you.
Related Posts:
- WP_Query – Order results by meta value
- Query to sort a list by meta key first (if it exists), and show remaining posts without meta key ordered by title
- Filter WP_Query for posts having a certain meta-value
- Can I query custom meta data through WP_Query
- Meta Query with AND & OR?
- How do I search an array stored in a custom-field using WP_Query?
- How do I order by multiple custom fields using wp_query?
- Trying to perform complex custom field query with order by set to field value
- Query meta field using between
- Order Posts by Closest Numeric Values
- 2 orderby in wp_query with 2 custom fields
- Can serialized arrays in DB be matched against serialized arrays with meta_query?
- How to get a meta value from all post
- Compare meta_query decimals not working right
- WP_Query multiple use of relation and/or
- Query Problem – Show posts within category ‘x’ that have a custom field between ‘y’ and ‘z’
- Using OR in WP_Query negates the “NOT EXISTS” compare
- WP_query : meta_key with custom rule for specific value
- How can I combine meta_query queries?
- How to filter a dd/mm/yyyy date from a custom field in a query
- Using WP Query to search by multiple meta fields
- Difference between ‘LIKE’ and ‘IN’ in meta queries
- Compare WP Custom Field date
- Sort by posts that have a featured image?
- WP_Query display next custom post from today’s date
- Order by value in serialized custom field
- $wp_query meta_key naming issue [closed]
- Author Page Custom Query WHERE author OR [post meta value] OR [post meta value]
- Meta_query and numeric comparison [closed]
- Adding Custom Fields to Search
- Upcoming Event: How do I sort database by custom date field, but ignore past dates?
- Any way to include custom fields in WP_Query results?
- Adding custom fields (post meta) before/during wp_insert_post()
- Multiple relationships in a query
- WP Query Returning All Posts
- How do I use wp_query for WordPress search?
- Meta query with timestamp using WP_query
- Conditional custom field query
- Order query by meta_value with multiple custom fields
- Auto Populate Custom Field with Complex Value That Increase by One?
- Custom WP_Query for WordPress Search Results with meta_query
- Meta Query And/Or
- How to combine custom fields to make one order-able value
- Passing meta_box string to post__in?
- Query post by date (stored custom field meta as yyyymmdd) and differentiate across 12 months
- meta_value and meta_key filtering returning no posts [closed]
- Select custom posts by meta_value and sort by a different meta value
- Can’t query by meta_key
- Adding custom field and querying from post table
- Meta query relation ‘OR’ not working as expected
- The best way to collision check in WP
- WP_query multiple custom fields not working
- Custom Query Fields – Altering Meta Value
- How to query for posts with either one or another custom field
- Multiple Custom Field Query
- How can I modify my meta_query to work with prices that are stored in the database that contain dollar signs and commas?
- Query to sort a list by meta key first (if it exists), and show remaining posts without meta key ordered by title
- WP Query multiple select form – meta_query help
- How to Order Posts by Custom Fields?
- WP_Query based on multiple metadata comparisons
- Complex WP_Query Using Post Date And Post Meta
- Display posts where date field matches current month?
- Show posts containing or not custom field
- Display agents (custom post type) alphabetically, except one who always shows last
- Query posts by Custom Meta (checkbox) & Genesis Grid Loop
- Apply the_content filter to a custom field with multiple values
- Adding another state (spam, reject, approve) to wordpress comments?
- Filter archive.php by custom meta
- Get updated meta data after save_post hook
- Order by meta_value_num DESC and meta_value ASC on WP 4.0
- WordPress altering my custom query, How to fix it?
- Order by meta_key in custom post type doesn’t affect the query
- Currency (price) formating on custom fields
- Custom image sizes for custom field media uploads
- converting custom field date format
- How can I get the number of custom post type posts that have a specific attachment image set?
- How to get Metabox custom field to show checked if value is updated using post meta query?
- How to create a shortcode to print specific values stored in a post meta array?
- Change order of posts
- URL Rewrite fires when retrieving a custom value?
- How to store post meta in an array
- Set checkbox as checked by default in a metabox
- ACF form edit front end post title does not change permalink
- WP Query ‘posts_per_page’
- Can I use a Custom Field as the Featured Image URL?
- Copy price categories to custom field
- Sanitize user input fields before wp_insert_post
- Use Advanced Custom Fields – replace line of code that hardcodes the tag into the template
- Advanced Custom Fields and Post Meta Fields Relation
- Cache issue with WP_Query and custom field filtering
- KEY and VALUE custom field issue
- Stripping and/or altering the content of a custom field (video URL)
- Custom field outside the loop and inside an array
- Custom Form / Search with Custom Post Type Data
- register_form, custom field not submitted on first try
- Filter query based on date in custom field
- get_post_custom_values not working
- add multiple values (array) to post meta_input
- Get posts by meta value except one post [closed]
- Assign class to Drop Down Selections in WooCommerce Products Custom Fields