WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Co-Authors Plus] Co-Author Queries (Taxonomy or ID) Not Consistent (2 posts)

  1. chazbeaner
    Member
    Posted 1 year ago #

    Using CAP for a real estate site and am encountering some very odd inconsistencies with the way the queries are responding.

    This is the page giving me issues: http://www.theagencyre.com/agent/hana-cha/

    The first query pulls in current listings by this particular author/agent using $curauth->ID. This works no matter what order the authors are listed. Per a previous thread, this shouldn't work, but it does and is the only way to get this author's listing pulled onto the page. The taxonomy query does not work, but the ID query does and works for everyone else too... weird:

    $args = query_posts( array(
    		        'post_type' => array(
    		                    'sale',
    		                    'lease',
    		                    'vacation'
    	                		),
    			'author' => $curauth->ID,
    	        	'tag__not_in'=>array('34'),
    	        	'post__not_in'=>array(8446),
    	        	'orderby' => 'meta_value_num',
    				'meta_key' => 'price',
    				'order' => 'DESC',
    	            );

    Further down the page, I'm pulling in Sold Listings using the same method, but the above query does not work in the same way... it only pulls in listings if the author is listed first. So, I'm trying to use the taxonomy query for this section, and that works for every author except this one. The ID query will work (if she's listed first), the taxonomy query doesn't work for her at all:

    $args = query_posts( array(
    		        'post_type' => array(
    		                    'sale',
    		                    'lease'
    	                		),
    				'tax_query' => array(
    							array(
    							'taxonomy' => 'author',
    							'field' => 'slug',
    							'terms' => $curauth->user_login
    							)
    						),
    	        	'tag'=> 'sold',
    	        	'orderby' => 'meta_value_num',
    			'meta_key' => 'price',
    			'order' => 'DESC',
    	            );

    I'm at a loss. The same exact query working in different ways on the same page. I am using wp_reset_query() and have tried wp_reset_postdata() and rewind_posts() to try and get the info back to square one so that the second query will work like the original. I've also tried using a new WP_Object() and query_posts() with the combination of the ID query and the taxonomy queries...

    TLDR;
    - First CAP query on page only displays this author's posts if using ID query and also works globally to pull in every author's posts no matter their order on the post;
    - Second CAP query with ID only pulls in posts if author listed first, taxonomy query works for every author except this specific one.

  2. chazbeaner
    Member
    Posted 1 year ago #

    This is the link for the plugin: http://wordpress.org/extend/plugins/co-authors-plus/

Topic Closed

This topic has been closed to new replies.

About this Topic