Adding Meta Box to Specific Submenu Page

I think for this you want to go with WordPress Setting API. If you prefer meta box. You have to add a do_action in your function which render the page (view_tasks_submenu_page_callback). do_action( ‘add_meta_boxes’, $hook_id ); And add do_meta_boxes($hook_id, $context, null) where you want your meta boxes appear. replace $hook_id by the fourth parameter of add_meta_box … Read more

How Add a Save Button to Custom Meta Box without Leave/Stay js Dialog?

HERE THE SOLUTION: If you want remove the default publish button and use a custom submit button for your Custom Meta Box, you have to insert the submit_button in a <div class=”submitbox” id=”submitpost”></div> e.g. <div class=”submitbox” id=”submitpost”> <?php submit_button( ‘Submit’, ‘primary’, ‘publish’, false ); ?> </div>

Unable to save multiple images in wordpress

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

Can’t get meta values to save

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