I'm trying to query the wordpress database for the post and what category they belong in. Is there a sql query that I can use for this?
To get a specific post in WordPress, you can use the get_post() function and get_the_category() to get the categories associated with it. You can then use the code found in this answer to dump the SQL queries used.
$post_ID = 7;
$the_post = get_post( $post_ID );
$the_category = get_the_category( $post_ID );
Sign up using Google
Sign up using Facebook
Sign up using Stack Exchange
1 year ago