mysql - Can't get `post_id` from table `postmeta` in wordpress -
I can not find a list of post_id from the table My query is working with mysql, I make changes to 'get_var', 'get_row', but it is not working. postmeta . This is my code.
function getPostID () {global $ wpdb; $ ListID = $ wpdb- & gt; Get_results ("Choose` qan_postmeta` from `post_ id` where 'meta_value` =' news'"); }
Try it out:
$ query = $ wpdb-> ; Get_results ("SELECT * FROM` wp_postmeta 'ou meta_value = 0 and meta_key REGEXP' ^ [a-zA-Z]. * $ 'ORDER BY' wp_postmeta '.`meta_value` ASC"); Print_r ($ query);
All posts in the wp_postmeta table are Metas. We need to select the field starting from the characters. (No "_");
So I use REGEXP in the SQL statement. Happy coding
Comments
Post a Comment