Tag Info

Hot answers tagged

2

Out of curiosity, I played around with static SQL queries and this one seemed to work: SELECT r.post_author, r.ID, r.post_title FROM ( SELECT p.post_author, p.ID, p.post_title FROM wp_posts p INNER JOIN wp_term_relationships tr ON ( p.ID = tr.object_id ) WHERE p.post_date < '2015-02-05 00:00:00' AND p.ID NOT IN (10,20) ...


2

I cracked it! In my case I first created an author.php page (my theme lacked one) from the archive.php by cloning and cleaning it. Then I found this piece of code: <?php if ( have_posts() ) : ?> It basically says: if the authors has published some posts, then... Well, I just added: "OR NOT!" <?php if ( have_posts() || !have_posts() ) : ?> ...


1

With what you are asking, it is really difficult to come up with some performant easy way that is also reliable. As @birgire already stated, his solution is not reliable, but from tests, it seem to be the fastest clocking in at 2 db queries in about 0.015s average. From a quick discussion between @birgire and me in comments to his answer, I've decided to ...



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