Query Custom Posts – Add To Selection

Use wp_reset_postdata(); to restore the global $post variable of the main query loop after a secondary query loop using new WP_Query. It restores the $post variable to the current post in the main query. call wp_reset_postdata(); after endwhile; <?php while($org->have_posts()) : $org->the_post(); ?> <option value=”<?php echo $post->post_name; ?>”><?php the_title(); ?></option> <?php endwhile; // reset main … Read more

Custom post type meta box empty after save

As @Milo Said. Your function is ended early. Try this for save_post action. add_action( ‘save_post’, ‘mob_datebox_save’, 1, 2); function mob_datebox_save( $post, $post_id ) { // Bail if we’re doing an auto save if( defined( ‘DOING_AUTOSAVE’ ) && DOING_AUTOSAVE ) return; // if our nonce isn’t there, or we can’t verify it, bail if( !isset( $_POST[‘meta_box_nonce’] … Read more

Custom meta boxes not saving

You are accessing the $_POST array in a wrong way. This is not possible: $_POST[‘imagefields[‘ . $i . ‘][image2]’] Correct way would be: $_POST[‘imagefields’][$i][‘image2’]; (You have the same mistake when accessing the $values array.) Also you are supposed to give the complete array to the update_post_meta() function instead of saving each value seperately: if(isset($_POST[‘imagefields’])) { … Read more