Get tag and category posts WP SQL

I am a ios developer and have some problems with sql queries.

I get wordpress posts with query like:

SELECT id, post_title, post_content FROM `posts` 
WHERE post_status = 'publish' AND post_type = 'post';

But I need to get some tag posts and category posts like:

SELECT id, post_title, post_content FROM `posts` WHERE category = '1';

and

SELECT id, post_title, post_content FROM `posts` WHERE tag = '1';

I got that tags and categories are in terms table. How can I connect two tables and get needed posts.

Read more here: Get tag and category posts WP SQL

Leave a Reply

Your email address will not be published. Required fields are marked *