1

I used to have a page on my site where it would show all posts by a user and it worked. This was the code it was using:

    <?php
    //$wp_query = new WP_Query( array( 'post_per_page' => 12 ));
    $wp_query->query_vars["posts_per_page"] = 24;
    $wp_query->query_vars["orderby"] = 'title';
    $wp_query->query_vars["order"] = 'ASC';
    $wp_query->get_posts();
    ?>

    <?php if ( have_posts() ) : ?>

Nothing has changed but it recently stopped showing results. Any ideas what has gone wrong?

1 Answer 1

0

You should uncomment first line and add author query var.

 $wp_query->query_vars["author_name"] = "John";

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.