search post by post ID
-
This function is working no longer, why?
add_filter('posts_where', 'posts_where'); function posts_where($where) { $s = $_GET['s']; if(!empty($s)) { if(is_numeric($s)) { global $wpdb; $where = str_replace('(' . $wpdb->posts . '.post_title LIKE', '(' . $wpdb->posts . '.ID = ' . $s . ') OR (' . $wpdb->posts . '.post_title LIKE', $where); } elseif(preg_match("/^(\d+)(,\s*\d+)*\$/", $s)) // string of post IDs { global $wpdb; $where = str_replace('(' . $wpdb->posts . '.post_title LIKE', '(' . $wpdb->posts . '.ID in (' . $s . ')) OR (' . $wpdb->posts . '.post_title LIKE', $where); } } return $where; }
The page I need help with: [log in to see the link]
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘search post by post ID’ is closed to new replies.