Call   0208 3131682   Mon-Fri 9am-6pm

WordPress SQL snippets

By January 22, 2018 PHP, SQL, Wordpress

A place to keep snippets of useful WordPress SQL.

Do a select based on some meta field of a post ( i.e. search for a post that has a particular metafield  )
In the example above I’m searching for posts with a value for id_vim_node. This is based on this code from stackexchange

Output WP_Query sql code (very useful for debugging WP_Query )

if in the loop

outside of loop

based on this post on stackexchange

Leave a Reply