in_category using array
-
I am trying to check if a title exists within a specific categories I want duplicate titles as long as they are in different categories. I think I need to use in_category with and array as the post_ID comparing if any of the post_ids are in the array. Thanks for any help.
global $wpdb; if ($posts = $wpdb->get_results("SELECT ID FROM wp_posts WHERE post_title = '".mysql_real_escape_string($title)."' && post_status = 'publish'", 'ARRAY_A')) { if (in_category($cat, $posts) == 1) { //Do Nothing } else { //Do Something } }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘in_category using array’ is closed to new replies.