Mysql
 sql >> Database >  >> RDS >> Mysql

Ricevi post da tutte le categorie tranne una

Prova qui sotto :-

14 è l'ID della categoria

 $request = $wpdb->prepare("SELECT * FROM $wpdb->posts 
  LEFT JOIN $wpdb->term_relationships ON($wpdb->posts.ID = $wpdb->term_relationships.object_id)  
  LEFT JOIN $wpdb->term_taxonomy ON($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)  

  WHERE ($wpdb->term_taxonomy.term_id <> 14  
     AND $wpdb->term_taxonomy.taxonomy = 'category'   
     AND $wpdb->posts.post_type = 'post'  
     AND $wpdb->posts.post_status = 'publish'
     AND post_title like '%$search%'
     AND post_date >= '" . date('Y-m-d').")");