Plugin Author
Ajay
(@ajay)
The include_cat_ids is captured in the process_query_args function where it is converted to a ‘tax_query’ which I can see in $this->query_args output above.
This is passed to WP_Query which then converts it to a JOIN and WHERE. What I am confused about the lack of the WHERE clause.
But CRP 3x still should work with pages instead of posts right?
Plugin Author
Ajay
(@ajay)
Yes it does. I was thinking of something else that should work.
Since 3x wraps around WP_Query you can use all the parameters that WP_Query offers. So, you could try instead of include_cat_ids, you use category__in
https://developer.wordpress.org/reference/classes/wp_query/#category-parameters
I believe this would work with the Gutenberg block but I don’t think it will work with shortcode as the shortcode cleans up parameters that are not set as default.
Just another point, is 58 a category or a custom taxonomy?
Ok thanks, I will look into this option.
58 is a custom taxonomy.
Plugin Author
Ajay
(@ajay)
@clsklvr
I was wondering if you could try something by editing the plugin file includes/class-crp-query.php
And delete this line: https://github.com/WebberZone/contextual-related-posts/blob/v3.0.3/includes/class-crp-query.php#L215
I’m not sure if it will make a difference but if it does, then I’ll change it in the next version.
Plugin Author
Ajay
(@ajay)
@clsklvr
I just made the change in a test install and I think it works – I did a var_dump in the posts_where as you did above and I see this the below. Note the 62 is the custom taxonomy in my case. When I didn’t delete the line I instead got a 0=1 like in your query above.
( wp_posts.post_date >= '1991-01-31 00:00:00' AND wp_posts.post_date <= '2021-01-23 17:07:33' )
) AND wp_posts.ID NOT IN (562,903,1333) AND (
wp_term_relationships.term_taxonomy_id IN (62)
AND
wp_posts.ID NOT IN (
SELECT object_id
FROM wp_term_relationships
WHERE term_taxonomy_id IN (10)
)
) AND wp_posts.post_type IN ('post', 'page', 'attachment', 'wz_knowledgebase') AND (((wp_posts.post_status = 'publish' OR wp_posts.post_status = 'inherit') OR (wp_posts.post_status = 'inh'...
Plugin Author
Ajay
(@ajay)
Thank you for confirming. I’ve committed this in the repo and will include it in 3.0.4