[Plugin: WordPress Related Posts] filter by postmeta
-
Hi all
I use WordPress Related Posts plugin and I want to filter the result by meta_key and meta_value. I try to change the query inside the plugin like this but I must miss something :
$q = " SELECT p.ID, p.post_title, p.post_content,p.post_excerpt, p.post_date, p.comment_count, p.post_id, p.meta_value, p.meta_key, count(t_r.object_id) as cnt FROM $wpdb->term_taxonomy t_t, $wpdb->term_relationships t_r, $wpdb->posts p, $wpdb->postmeta pm WHERE t_t.taxonomy ='post_tag' AND t_t.term_taxonomy_id = t_r.term_taxonomy_id AND t_r.object_id = p.ID = p.post_id AND (t_t.term_id IN ($taglist)) AND p.ID != $post->ID != p.post_id AND p.post_status = 'publish' AND p.post_date_gmt < '$now' AND pm.meta_key = 'custom_field_disponibilite' AND pm.meta_value = 'DISPO' GROUP BY t_r.object_id ORDER BY cnt DESC, p.post_date_gmt DESC $limitclause;";
If you have any input feel free to comment!
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘[Plugin: WordPress Related Posts] filter by postmeta’ is closed to new replies.