How to select post ID for given parent name with nested prepared queries?
I’ve just started development for the wordpress environment. I am trying to create a prepared statement for the nested query which selects post ID (ID) for the specified parent name (post_parent)? Is it at all possible, because I couldn’t find too much on the nested queries in wp, never mind using prepare for it.
This is the SQL I wrote to achieve it.
SELECT ID from wp_posts WHERE post_parent=(SELECT ID FROM wp_posts WHERE post_title="Phase 1" AND post_name="phase-1") AND post_title !="Phase 1"
Can I at all write one prepared statement for it or do I have to first get an array of child pages and then run another query in a loop?