Codestar / codestar-framework

A Simple and Lightweight WordPress Option Framework for Themes and Plugins
http://codestarframework.com/
GNU General Public License v2.0
284 stars 98 forks source link

How can I search Post by Meta_query? #160

Open jahidcmt4 opened 1 year ago

jahidcmt4 commented 1 year ago

I'm using Codestar framework. my post type is hotel and post meta key is tf_hotel_meta. Below is my meta value. I want to show post if address = location. How can I do it?

a:18:{s:7:"address";s:2:"location";s:3:"map";s:144:"a:4:{s:7:"address";s:23:"Erfurt, Erfurt, Germany";s:8:"latitude";s:17:"50.98476789999999";s:9:"longitude";s:10:"11.0298799";s:4:"zoom";s:1:"2";}";s:7:"gallery";s:15:"2930,23,3120,16";s:8:"featured";s:0:"";s:5:"video";s:0:"";}

amrinz commented 1 year ago

Same problem here for query posts, original code:

$query=new WP_Query(array(
  'post_type' =>'post',
  'showposts' => 1,
  'meta_key'    => 'headline',
));

The Custom field looks like this: $prefix = 'lmd-antarakyatnews__metabox';

Saved Post Meta in Database:

array ( 0 => array ( 'headline' => '1', 'lmd_editor' => '2', 'ytbid' => '4CzYXfBeIdM', ), )

How do I alter my query?