WordPress.org

Forums

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

  1. Zadro7
    Member
    Posted 1 year 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/

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Co-Authors Plus
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.