Hello everyone, I currently have a button on my website that shows a random article when the users clicks on it. However I recently found out that some of the posts are from a category that I don't want to be shown.
My question is, how do I alter this code so that it only shows posts from a certain category?
$randomPost = $wpdb->get_var("SELECT guid FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' ORDER BY rand() LIMIT 1");
Thanks for the help!