Use SQL to select fields from wordpress listings -


I am using a WordPress theme which can store a lot of information, which I'm eager to access I am

I am trying to reach latitude and longitude (which is stored in a field called 'Location'), these posts are stored in Wordpress posts with word posting 'listings'.

I can get to do this work, but this does not require the field I want to:

  $ Query = "Choose DISTINCT ID, $ post_title Wpdb-> Post WHERE post_type = 'listing' "; $ Value = $ wpdb- & gt; Get_results ($ query); Print_r ($ value);   

When I add to the location field (like below), it does not work, the array is returned blank.

  $ query = "Select ID, post_ title, location $ wpdb-> post WHERE post_type = 'listing'"; $ Value = $ wpdb- & gt; Get_results ($ query); Print_r ($ value);   

I have also attempted to place the quotation marks, but then I get a result like this, for each entry:

Array ([0] = & gt; stdClass object ([ID] => 5299 [post_title] = & gt; My post title [location] = & gt; location)

Any help should be able to reach Latitude:

I think your The meta key is 'location', so you It can be reversed this way. You must first pass the post ID as the ID

  $ location = get_post_meta ($ post_id, 'location'); For more information,   

or

if you want it your way:

  $ query = "Select Meta_ID, from FROM $ Wpdb-> PostMeta WHERE meta_key =" Location "from Meta_View;"; $ Value = $ wpdb- & gt; Get_results ($ query); Print_r ($ value);    

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -