Update Post Meta in Front End with a form
Since you are using this code in the shortcode, I suppose the reason is the lack of post ID. You want to get the ID of the current post from the $post variable, but to make it possible you need to add the global $post; earlier (at the beginning of the function, or at least … Read more