WordPress.org

Ready to get started?Download WordPress

Forums

Co-Authors Plus
WP Query with CPT (1 post)

  1. Zadro7
    Member
    Posted 11 months ago #

    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
        endwhile;
    endif;

    http://wordpress.org/plugins/co-authors-plus/

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.