delete duplicate meta_value with same post_id
After investigating, I realized that it was left over from some fields that I no longer used so I was able to get rid of them.
After investigating, I realized that it was left over from some fields that I no longer used so I was able to get rid of them.
As kaiser pointed out, you need to use the save_post hook to call your save_my_metadata() function. See this code sample for a complete example of saving (and validating) metabox data: https://github.com/Veraxus/nv-example-meta-box/blob/master/init.php
You can find the Advanced Custom Fields fields which you added in the $_POST array under the ‘fields‘ key. Use ACF’s get_field_object() function to get the key of your field you added. So if you named your field ‘nr_available’, you have to find its key to be able to find this field in the $_POST … Read more
You want to get the data out of the custom post type, assign it to a variable, then echo that value into the field when the page loads. If nothing else, that will make your code a lot more readable (and easier to troubleshoot) While it’s not explicitly about what you are doing, you an … Read more
I believe the problem is with your use of sanitize_text_field (line 668 in your pastebin), which will strip markup. Proof of concept: $str=”<p>Howdy Ho!</p>”; echo $str; echo sanitize_text_field($str); You will need to use some other function to clean the data… possibly wp_kses
With this answer with good practices, by Chip Bennett, in mind just do a simple global thing — add global $authordata to your template file: <?php global $authordata; ?> Follow the Codex’s Global Variables article for details about the global practice. Quoting the portion specific to the Question: $authordata (object) Returns an object with information … Read more
Use get_the_ID(), the post object is not set up completely on wp_head(): if ( is_singular() ) $post = get_post( get_the_ID() );
Here’s the repair, for good measure and anyone curious: add_action(“gform_after_submission_5”, “books_promoter”, 10, 4); function books_promoter($entry, $form) { global $post; global $wp_query; $post_id = get_the_ID(); // $entry[‘post_id’]; $post_data[‘status’] = get_post_meta($post_id,’status’, true); $post_data[‘promoter’] = get_post_meta($post_id,’promoter’, true); $status = $entry[‘5’]; $promoter = $entry[‘6’]; update_post_meta($post_id, ‘books_status’, $status ); update_post_meta($post_id, ‘books_promoter’, $promoter ); }
Use get_post_meta() function to get value of desired meta key. You can get more details on this link: http://codex.wordpress.org/Function_Reference/get_post_meta
First of all get_users_of_blog has been deprecated, so you should use get_users instead, or run a WP_User_Query. After that, the_author_meta echo the meta value, not return anything. To return the meta you should use get_the_author_meta() $blogusers = get_users( $args ); // for args see codex if ($blogusers) { foreach ( $blogusers as $bloguser ) { … Read more