I know there is connection between post table with term table but I am unable to figure it out.
wp_term_taxonomy relation is a little confusing. So, I am unable to write a query to get term id from post id.
I am using this piece of code to get an object and extract term id from that. But for some reasons, it is not working so I want to manually query in database to pull the term id and do rest of process.
it returns this object: (on local machine)
stdClass Object ( [meta_id] => 1268 //this id is passed to function like get_metadata_by_mid('post', 1268); [post_id] => 222 //want to obtain this ID [meta_key] => _menu_item_url [meta_value] => )
Returns no result (on server) [so looking for alternative way]
get_metadata_by_midworks on local machine but doesn't work on live (i don't know, why whereas I have same version in both environment)
- If someone can provide alternative way then it would be better than manual query.