Custom select query
-
Hi,
I try to use a custom select query to display all the posts of a UTW tag (Tag id = 546).
The page http://codex.ww.wp.xz.cn/Displaying_Posts_Using_a_Custom_Select_Query is very clear but I fail to make the first query to replace this :<?php
$pageposts = $wpdb->get_results("SELECT wposts.* FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta
WHERE wposts.ID = wpostmeta.post_id AND wpostmeta.meta_key = 'tag' AND wpostmeta.meta_value = 'email' AND
wposts.post_status = 'publish' AND wposts.post_date < NOW() ORDER BY wposts.post_date DESC", OBJECT);
?>This query displays all the post id linked with the tag 546 :
SELECT 'post_id' FROM 'wp_post2tag' WHERE 'tag_id' = 546If it’s easy for you, please help me.
thanks
The topic ‘Custom select query’ is closed to new replies.