Quantcast
Channel: Stillatmylinux
Viewing all articles
Browse latest Browse all 16

No Posts Found When Viewing Custom Taxonomy Archive Page

$
0
0

The problem: you know you have posts associated with a custom taxonomy, but they aren’t showing up. So you do a var_dump on the wp_query. You notice that the SQL query includes an odd statment: wp_posts.ID IN (0). That will always return 0 results. I thought I’ve seen this error before, but not remembering for sure, I disabled all the plugin. It worked.  Then narrowed it down to a single plugin. The culpurit: Fantastic Elasticsearch.

The solution: re-index elasticsearch

SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  
	INNER JOIN wp_term_relationships ON 
		(wp_posts.ID = wp_term_relationships.object_id) 
	WHERE 1=1
		AND wp_posts.ID IN (0) 
		AND ( wp_term_relationships.term_taxonomy_id IN (1140) ) 
		AND wp_posts.post_type = 'article' 
		AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'private') 

	GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 10

 

enable-for-all-custom-post-types-archives

The option to enable for all custom post types archives might also help too.


Viewing all articles
Browse latest Browse all 16

Trending Articles