bodyparts11

mail@pastecode.io avatar
unknown
php
a year ago
854 B
3
Indexable
Never
<?php
$args = array(
    'post_type' => 'post',
    'meta_query' => array(
        'relation' => 'OR',
        array(
            'key' => 'bookid',
            'value' => '%"432"%',
            'compare' => 'LIKE'
        ),
        array(
            'key' => 'bookid',
            'value' => '%"79"%',
            'compare' => 'LIKE'
        ),
        array(
            'key' => 'bookid',
            'value' => '%"432";s:2:"79"%',
            'compare' => 'LIKE'
        ),
        array(
            'key' => 'bookid',
            'value' => '%"79";s:3:"432"%',
            'compare' => 'LIKE'
        ),
    ),
);

$query = new WP_Query( $args );

if ( $query->have_posts() ) {
    while ( $query->have_posts() ) {
        $query->the_post();
        // Do something with each post
    }
    wp_reset_postdata();
} else {
    // No posts found
}