faq

My user post list only displays one post, instead of the entire list.

– This article requires web developer skills and is not covered by our support.

We have encountered this behaviour before when WP_Query() does not work fully. This is the code we use for generating the relevant posts for a user.

$types = get_post_types(array( 'public' => true ));
            $args = array(
                  'numberposts'   => -1,
                  'post_type'     => $types,
                  'meta_query'    => array(
                    array(
                      'key'       => '_oacs_spl_user_liked',
                      'value'     => 1, // Insert any user ID (integer) here. 
                      'compare'   => 'LIKE'
                    )
                  ) );
            $sep = '';

            $wp_query = new \WP_Query($args); 

And here is a simple WP_Query() example.

$args = array(
    'posts_per_page' => 10,
    'post_type' => 'post',
);
$query = new WP_Query( $args );

In order to find out whether your WP_Query() works ok, try running both or the simple version on your site. We like using WP Console for our repl driven testing: https://wordpress.org/plugins/wp-console/

Check how many posts the query returns. If it is stuck at 1, your WP_Query() is in trouble and needs custom debugging.

If the count is correct, let us know by asking a support question.

Scroll to Top