<?php if(isset($_POST['jolly'])){ update_post_meta($post->ID , 'carry', 3); } ?> <form action='' method='POST'> <input type='submit' name='jolly' value='test' /> </form> Are there alternative ways? … [Read more...] about How can I update post meta inside a WP_Query loop or the WordPress loop?
Update post meta wordpress
How can I free up the memory used by update_post_meta?
... Used memory 1: 17995848 Used memory 2: 17996992 Used memory 1: 17996992 Used memory 2: 18027720 Used memory 1: 18027720 Used memory 2: 18058448 Used memory 1: 18058448 Used memory 2: 18089176 Used memory 1: 18089176 Used memory 2: 18119904 ... Without the update_post_meta statement, the memory usage stays the same throughout the entire loop (as expected). … [Read more...] about How can I free up the memory used by update_post_meta?
Use a Variable in update_post_meta as the $meta_key
$current_post = $post->ID; $title = get_the_title(); $s1 = $title . "s1"; $week_s1 = "_member_score_".$week._s1"; $post_information = array( // Look at this // 'ID' => $current_post, 'post_title' => $title, 'post-type' => 'CTP-Name', 'post_status' => 'publish', ); $pidac = wp_update_post($post_information); if($pidac) { update_post_meta($pidac, $week_s1, $_POST[$s1]); $term_ids = array( 2, 7 ); $taxonomy = 'Custom-Taxonomy'; wp_set_object_terms( $pidac, $term_ids, $taxonomy ); // Redirect wp_redirect( home_url() ); } } If you echo $week_s1 all is ok … [Read more...] about Use a Variable in update_post_meta as the $meta_key
How to Add Custom Post Status for Blog Posts in WordPress
Pitch – Used to pitch new article ideas and this status also becomes the default post status of every new post. Assigned – You can select an author and mark an article as assigned so that the author can work on it. In progress – Writer is working on the post but is not yet available as a readable draft. You can create your own custom status by providing a name and description in the left column. Once you are done, click on the ‘Add new status’ button to save your changes. … [Read more...] about How to Add Custom Post Status for Blog Posts in WordPress
Update post meta data (custom field) by post link
I have a post in my WordPress website, which has lot of custom fields. I have an Excel sheet with "post link" - "custom field data" combination. That custom field (video URL) is already set for each post, but now I need to change and update those links based on the Excel sheet. I don't have a "post_id - post meta data" combination, just link and appropriate meta data value. … [Read more...] about Update post meta data (custom field) by post link