Tag Info

Hot answers tagged


I believe that you can achieve this effect by grouping the query by author ID, which will require a filter(mostly cribbed from the Codex): function my_posts_groupby($groupby) { global $wpdb; $groupby = "{$wpdb->posts}.post_author"; return $groupby; } add_filter( 'posts_groupby', 'my_posts_groupby' ); If you have less than 8 authors, ...


I'm not sure what you're doing with the above script, but here are some random suggestions: Avoid using the root user, for security reasons create another database user with less powers. Avoid using deprecated mysql_* calls. Use WP_Query() or get_posts() instead of hardcoded SQL queries. Use global $wpdb object if you really must use hardcoded SQL ...

Only top voted, non community-wiki answers of a minimum length are eligible