Custom Post Status 404 URL

this function changes the post to draft, you only have to call it and pass the post id where you want the function to work function postToDraft($post_id){ $post = array( ‘ID’ => $post_id, ‘post_status’ => ‘draft’ ); wp_update_post($post); }

Passing in MySQL prepare statement parameter separately throwing error

$query = (“SELECT * FROM <tablename> WHERE user_id = {$user_ID}”); // string variable $stmt = $wpdb->prepare($query); Say your $user_ID is 9, this will get evaluated to: $query = (“SELECT * FROM <tablename> WHERE user_id = 9”); $stmt = $wpdb->prepare($query); and finally becomes $stmt = $wpdb->prepare(“SELECT * FROM <tablename> WHERE user_id = 9”); Now it is … Read more