$_GET[ ] with wpuf_add_post_after_insert

This topic contains 1 reply and 2 voices, and was last updated by Tareq Hasan 10 years, 3 months ago
Viewing 1 Posts - 1 through 1 (of 1 total)
Author Posts
December 2, 2013 at 10:56 pm 13144
Tareq Hasan url home_url/add_new_post_form/?event_id=942 function is not not working / meta field is created but there is no value
function meta_event( $post_id ) {
			
			if ( isset( $_GET['event_id'] ) ) {
		        update_post_meta($post_id, 'event', $_GET['event_id'] );
			}
}
add_action( 'wpuf_add_post_after_insert', 'meta_event' );
December 3, 2013 at 1:10 pm 13177
Tareq Hasan Tareq Hasan

You can’t access the $_GET variable in that action hook. It’s running via ajax and no $_GET variables are passing there. You could insert the event id as hidden field in the form and then you can access it with that action hook.

Viewing 1 Posts - 1 through 1 (of 1 total)