Hello,
I'm trying to make a WP_Query where I want to display specifics posts.
Nothing complicated, it's quite easy with WordPress.
But I have a problem with the way Toolset stores checkbox data (it's serialized)
In toolset, my custom fields "Visibility" are 3 checkboxes: "Public" "Member only" and "Admin".
If, the "public" checkbox is checked then I display it (as my query is forged).
add_action( 'elementor/query/homepage_communication', function( $query ) {
$query->set( 'post_status', [ 'publish' ] );
$query->set( 'post_type', [ 'communication' ] );
$query->set( 'meta_query', [ ['compare' => 'IN', 'key' => 'wpcf-communication_visibility', 'value' => 'public'] ] );
} );
But, the meta data looks like this :
["wpcf-communication_visibility"]=>
array(1) {
[0]=>
string(197) "a:2:{s:64:"wpcf-fields-checkboxes-option-5cea2076154a49b3683901cdc9174e3f-1";a:1:{i:0;s:6:"public";}s:64:"wpcf-fields-checkboxes-option-af4d6c8d37c4e8781e6ca35aae024344-1";a:1:{i:0;s:7:"members";}}"
}
So, i'm not sure how to use the meta_query with theses data.. Any help?
I used "LIKE" to compare and it seems to work.