you can do something like this:
$args = array(
'posts_per_page' => 1000,
'post_type' => 'post'
);
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) {
while ( $the_query->have_posts() ) {
$the_query->the_post();
$casa_id = $post->ID;
update_post_meta($post->ID, 'casa_id', $casa_id);
}
}
Related Posts:
- Advanced Custom Fields: how do I check to see if a value is set in an field? [closed]
- Add validation and error handling when saving custom fields?
- The “_encloseme” Meta-Key Conundrum
- Tabindex on text input immediately after WordPress title input
- SELECT max(meta_value) FROM wp_postmeta WHERE meta_key=’price’… stops working when value is over 999
- Display custom field value on woocommerce product page
- Allow user to create instances of custom field
- get_pages sort alphabetically by meta value
- Add custom field (value) to search result (without plugin)
- How to add a theme custom variable to a post title?
- 2 orderby in wp_query with 2 custom fields
- Check before publishing, if already exist post with current custom field value
- Order Custom post type loop by custom field (datepicker)
- Localized Date Format for Custom Field
- Check if the value of a field has changed on save_post
- How to edit multiple post with Custom fields
- Saving custom image meta fields
- Echo values from custom field outside loop php
- Transfer self made functions.php custom fields to Advanced Custom Fields [closed]
- Complex WP_User_Query call fails on production server
- Query post order by post and desc not working
- If category then echo a custom fields
- How can I show custom fields in the loop only to specific user roles?
- Show 1 post and after a specific date show the next one
- How do I define post titles as images using Custom Fields?
- How to show Small Box Inside Content Area, which holds (text, images, links)?
- Sort custom field by post
- How to order posts by one custom field and filter them by another one?
- Can we create a WordPress read-only virtual field derived from three other fields?
- How to create a gallery custom field for WordPress post?
- How to display image inside container of custom made widget
- List users by sum of all their posts’ custom field values
- Duplicate (or more) custom fields on many posts. Is there an easy way to clean them up?
- How to add new field to the account address?
- Split the_title
- Sort WP_Query with numeric custom field
- Display Multiple Values of Same Key
- How to Wrote Simple Calculations by Using Custom Fields in Loop?
- Loop through incrementing custom fields
- Enable a short code in the custom meta field
- The conditional logic only works to show or hide?
- Problem uploading different files as custom fields with front end post form
- How to change order of posts in admin
- Custom product fields in wp e-Commerce plugin [closed]
- How to query for posts with either one or another custom field
- How show post only from after custom date
- How can I modify my meta_query to work with prices that are stored in the database that contain dollar signs and commas?
- How to add extra field in admin comment section
- wordpress multi user question
- How to sort post listing on a page using custom field value?
- Odd functions.php issue in WordPress
- Filter or order based on custom field
- Type character in name and make it invisble
- How to set up page fields with gutenberg instead of ACF
- Move the post title to another field
- ACF multi taxonomy on filterable gallery
- How to improve my non-unique metadata MySQL entries?
- Custom user registration fields in user_register hook
- Unable to change checkout placeholder text
- Store comment form custom field in custom database
- Custom Fields Not Showing (ACF not installed)
- author.php not showing content if Author has no Posts
- How do I update custom field post meta in frontend post template?
- Sorting post by custom fileds date
- Query multiple meta values at the same time :
- How to Find List of Available Custom Fields for Theme?
- get wordpress post loop by meta box date
- Sort posts by custom fields with empty values
- Custom Fields Not Working In Footer
- Sub Field of File Field
- ACF plugin and field update
- Add custom field to post with some part of url as value
- Adding custom fields to images
- How to save dynamically generated value in post type?
- CSS conditional on custom field value
- My meta boxes update wp_postmeta of posts but not of pages. What is wrong with the code?
- how to show this part only in the single post page?
- WP Post Meta Box Field Not Showing Updated Field
- WP_Query based on multiple metadata comparisons
- same custom field for single posts
- Import data from arbitrary CSV to WPAlchemy meta fields
- Post thumbnail size for custom field only
- Display meta data from a custom field within plugin Category Grid View Gallery
- Checking if field is set before comparing with meta_query in query_posts?
- Alter SQL query to return posts with unique custom field value, no duplicate values
- custom field output after the_content
- Insert shortcode before and after a list automatically
- Only show content slideshow if “slideshow” custom field exists
- If post custom meta data is not set, show normal state
- Post count by meta_key meta_value [closed]
- Change post status by custom fields
- update_post_meta based on acf repeater field
- How to include custom field in shortcode (do_shortcode) in theme file
- Query posts by Custom Meta (checkbox) & Genesis Grid Loop
- custom field with links
- Custom fields: Split data from single custom field’s sub-array to separate custom fields when saving post
- How can I copy value from dropdown once I select it to text area as text?
- Is there a way to read JSON data inside Custom Fields without editing PHP? [closed]
- Modal pop-up HTML code works on other sites or HTML viewers but not in the custom HTML block within a wordpress page?
- Automatically changing a posts status to draft based on magic fields [closed]