$querystr1 = "SELECT p.ID,p.post_title,t.term_id FROM wp_posts p LEFT JOIN wp_term_relationships rel ON rel.object_id = p.ID LEFT JOIN wp_term_taxonomy tax ON tax.term_taxonomy_id = rel.term_taxonomy_id LEFT JOIN wp_terms t ON t.term_id = tax.term_id where tax.term_taxonomy_id=5 ORDER BY p.ID DESC limit 1"; $pageposts1 = $wpdb->get_results($querystr1); print_r($pageposts1);
We provide online web development solution like PHP,jQuery,Laravel,Wordpress and we cover the latest tech news and how to tech and tricks.
Thursday, March 1, 2018
How to select all post data by category from database in php | Wordpress.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment