Catch the category whith a Mysql query
-
Hello,
I’m trying to catch in a Mysql query the post category. Here is my query (in my function) :
function parutions($categorie, $nouveau, $limite) {
global $wpdb;
$now = current_time(‘mysql’);
$arcresults2 = $wpdb->get_results(“SELECT ID, post_date, post_title FROM ” . $wpdb->posts . ” WHERE post_category = $categorie AND post_date <‘” . $now . “‘ AND post_status=’publish’ AND post_password=” ORDER BY post_date DESC LIMIT $limite”);…
But it doesn’t work. I have a look in the DB and (surprise) the post_category field in the wp_posts table is empty (‘0’) for every posts.
What I don’t understand is that posts in the backend have the right category ! So I’m totaly lost. Why this field if it’s empty ? And how to catch the category of a post ?
Thankx for your help
- The topic ‘Catch the category whith a Mysql query’ is closed to new replies.