最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

php - How to select post ID for given parent name with nested prepared queries?

programmeradmin2浏览0评论

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?

发布评论

评论列表(0)

  1. 暂无评论