it was like this: 'meta_query' => array( array( 'key' => '_my_meta', 'value' => 'addtosidebar', 'compare' => 'LIKE' ) ) โ CIPPO Design
This worked for me, I think it needs to be added as an answer. One thing, as Richard pointed out, is that the record in the database is serialized. Thus, "LIKE" will basically just look for the "value" addtosidebar on this line.
For example, if I have a meta array like this:
Message 1:
$myMeta = array('medium' => 'video', 'sometext' => 'a beautiful video')
Message 2:
$myMeta = array ('medium' => 'image', 'sometext' => 'a beautiful image of a video button')
This means that using the โLIKEโ comparison in โvideoโ will return both as a video and in the โsometextโ value of the second message. To stop this, I had to add quotation marks to limit it:
$query->set( 'meta_query' , array( array( 'key' => 'blogInfo', 'value' => '"video"', 'compare' => 'LIKE' ) ));
Hope this helps someone and that I can figure it out.
ps: Sorry, I'm not welcome enough to just comment.
source share