Support » Plugin: Co-Authors Plus » WP Query with CPT

  • I’m having a problem with creating a query for getting the CPTs of a certain author within author.php template. The following code is being used:

    global $wp_query;
    $curauth = $wp_query->get_queried_object();
    $args = array(
        'author' => $author_login->ID,
        'post_type' => 'cpt_name'
    $author_query = new WP_Query($args);
    if ($author_query->have_posts()) :
        while ($author_query->have_posts()) : $author_query->the_post();
        // write something code

  • The topic ‘WP Query with CPT’ is closed to new replies.