wp_insert_post is creating duplicate posts from Safari
-
I’m creating custom post types from the front end with a form. It works fine in Chrome and Firefox, however from Safari duplicate posts are created. This is part of the code
if( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) && $_POST['action'] == "new_post") { $tags = $_POST['post_tags']; $new_post = array( 'post_title' => $title, 'post_content' => $description, 'post_category' => array($_POST['cat']), 'tags_input' => array($tags), 'post_status' => 'publish',etc. 'post_type' => 'website' ); global $current_user; get_currentuserinfo(); $user_name = strtolower($current_user->user_login); //custom caps will default to lowercase anyway $pid = wp_insert_post($new_post); update_post_meta($pid, "s2member_ccaps_req", $user_name, true); wp_redirect( get_permalink($pid) ); exit();I’ve viewed the $pid using var_dump and it returns a valid ID, the code works fine in Chrome and FF, so what else can this be? Any tests I can run?
The topic ‘wp_insert_post is creating duplicate posts from Safari’ is closed to new replies.