How to write query for getting child post id of the parent post from a different table in Wordpress?
I have many custom post types in Wordpress, Each post type have many child post type Like this:
California School > Video 1 , Video 4 , Video 7
{School and Video are custom post types}
I have a table like this:
Table name is kg_toolset_associations
(This table created by Toolset plugin.)
I'd like to get the ID of all videos that associates to parent school;
I wrote this query :
<?php
global $wpdb;
$results = $wpdb->get_results( "SELECT `child_id` FROM `kg_toolset_associations` WHERE `relationship_id` = `4` AND `parent_id` = `8568`, OBJECT );
?>
- I have tried to follow the advice from When to use single quotes, double quotes, and backticks in MySQL but using back ticks still does not work.