Trouble modifying post metakey value from frontend
-
Hi, I am trying to use a radio form to modify a custom metakey value for posts. The posts wont have the metakey assigned at first, so I will use update_post_meta for its fallback capability to add_post_meta.. but I am having trouble with something simple!
Anyone see whats wrong? my code gets the value correctly, but doesnt update the metakey on submit via button or with my fancy onclicks…//Function to create radio buttons to change post metakey tentativeastatus function display_tentative_approval_buttons() { Global $post; $tentativeastatus = get_post_meta($post->ID, 'tentativeastatus', true); //check if pre-approved if ($tentativeastatus == "pre-approved") { $tentativeastatusp == "checked"; } //check if waitlisted if ($tentativeastatus == "waitlisted") { $tentativeastatusw == "checked"; } //check if denied if ($tentativeastatus == "denied") { $tentativeastatusd == "checked"; } //display current status echo '<small><u>Currently: ' . $tentativeastatus . '</u></small><hr />'; //start the form echo '<form method="post" action="">' . wp_nonce_field('update_wcepsa_postmeta','wcepsa_inventory') . ' <input type="radio" name="tentativeastatus" value="pre-approved" onClick="submit();" ' . $tentativeastatusp . ' /> Pre-Approved<br /> <input type="radio" name="tentativeastatus" value="waitlisted" onClick="submit();" ' . $tentativeastatusw . ' /> Waitlisted<br /> <input type="radio" name="tentativeastatus" value="denied" onClick="submit();" ' . $tentativeastatusd . ' /> Denied <br /> <small>Click to Modify</small> </form>'; } //change tentative post status if ( isset( $_POST['wcepsa_inventory'] ) && wp_verify_nonce($_POST['wcepsa_inventory'],'update_wcepsa_postmeta') ) { //if nonce check succeeds. global $post; $postid = $post->ID; $data = $_POST['tentativeastatus']; update_post_meta($postid,'tentativeastatus',$data); }
anyone see why it wont save?
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Trouble modifying post metakey value from frontend’ is closed to new replies.