'doctor', 'posts_per_page' => '1', 'meta_query' => array( array( 'key' => 'medecins_id', 'value' => $_GET['id'], 'compare' => '=' ), ), ); $the_query = new WP_Query( $args ); // The Loop if ( $the_query->have_posts() ) { while ( $the_query->have_posts() ) { $the_query->the_post(); header('Location: '.get_permalink()); exit; } } else { header('Location: /account/'); exit; } } if (isset($_POST['ids'])){ $ids = explode(',', $_POST['ids']); ?> ID; if ($user_id == $_POST['u']){ update_user_meta($user_id, 'patient_id', $_POST['pid']); update_user_meta($user_id, 'patient_phone', $_POST['phone']); update_user_meta($user_id, 'all_cards', implode(",", $_POST['cards'])); } } die(); ?>