Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I search Post by Meta_query? #160

Open
jahidcmt4 opened this issue Feb 8, 2023 · 1 comment
Open

How can I search Post by Meta_query? #160

jahidcmt4 opened this issue Feb 8, 2023 · 1 comment

Comments

@jahidcmt4
Copy link

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:"";}

@jahidcmt4 jahidcmt4 changed the title How can I search How can I search by Meta_query? Feb 8, 2023
@jahidcmt4 jahidcmt4 changed the title How can I search by Meta_query? How can I search Post by Meta_query? Feb 8, 2023
@amrinz
Copy link

amrinz commented Feb 20, 2023

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants