Metabox messes up permalink
Add the code before add_meta_box. I have updated the first post as well. // TEMP-FIX FOR FAULTY PERMALINKS global $post, $wp_query; $wp_query->post = $post;
Add the code before add_meta_box. I have updated the first post as well. // TEMP-FIX FOR FAULTY PERMALINKS global $post, $wp_query; $wp_query->post = $post;
Now in saving function … in which hook ? if you do this in “save_post_CPT”, it doesn’t work because this hook is called a first time a the object creation then you have to do this : add_action(“save_post_CPT”, function ($object_ID, \WP_Post $object, $update) { if (!$update) { // new object, here you can define default … Read more
You are updating the same post_meta on each loop. Therefore you are probably saving the last uploaded image only. Try something like this (simplified): foreach ($_FILES[‘wp_custom_attachment’][“tmp_name”] as $key => $value) { $post_meta = get_post_meta($id, ‘wp_custom_attachment’, $upload); if( $post_meta ) { $post_meta .= ‘, ‘ . $upload; update_post_meta($id, ‘wp_custom_attachment’, $post_meta); } else { add_post_meta($id, ‘wp_custom_attachment’, $upload); … Read more
wp_editor metabox does not output the saved html format
Have you tried passing in the $args variable to query_posts, rather than $guide? query_posts($args); Also, you should be looking to create the custom query using WP_Query class and not the query_posts. See this answer for more details (https://wordpress.stackexchange.com/a/1755) Try the below code: $args = array(‘post_type’ => ‘post’, ‘meta_key’ => ‘meta_date’, ‘meta_value_num’ => , ); $my_query … Read more
i found the answer i just add global $wpdb; then update the database $wpdb->query( “UPDATE `$wpdb->posts` SET `post_content` = ‘”.current_time(“Y-m-d H:i:s”).”‘ WHERE `ID` = ‘”.$_POST[‘content’].”‘” );
add instructions to upload pages and / or forms
I have just tested your shared code on my site and it is working fine for me displaying path of saved image using following code as shown in the attached screenshots. echo get_post_meta( get_the_ID(), ‘project_logo_logo-image’, true ); Please make sure you have added the above code in the file where the post id is accessible.
Figured it out: There was a space in the field ID, and the $_POST key would collapse it. So the ID’s weren’t matching up in the foreach loop in my save function. I solved this with a sanitizing function on the IDs for my meta fields. I was further confused because my admin notices that … Read more
After reviewing your code there are a couple of things you need to change depending on where the meta content is being held. Try this to get the value $desc = get_post_meta( get_the_ID(), ‘meta_desc’, TRUE ); echo $desc; That Will be give you the appropriate meta.