$exclude code and $sql code are not filtering correctly
-
So I have a blog, blogs.luc.edu/goglobal, any everything was working fine but recently we had to add an $exclude code because admins were showing up, even though they did not have posts, here is the code we added:
<?php $excluded = '824, 265, 1691'; // To exclude Admin accounts $sql = 'SELECT DISTINCT post_author FROM '.$wpdb->posts. " WHERE post_author NOT IN ($excluded) and post_status != 'trash' ORDER BY ID DESC LIMIT 7"; $authors = $wpdb->get_results($sql); if($authors): foreach($authors as $author): ?>
The issue is that the “Who Bloggin'” list used to update with the most recent blogger who actually submitted a post. This functionality does work if I remove the “post_author NOT IN ($excluded) and” part from the above code but if I remove that it then shows the 3 admins even though they do not have posts. Does anyone know a work around to get this Blog list to update but also keep the $exclude code in there or even a work around for that as well.
- The topic ‘$exclude code and $sql code are not filtering correctly’ is closed to new replies.