Suppose I have two meta keys A and B for wordpress post. I need to get all posts where values of A != B using Wp_Query. I could only find codes to compare multiple keys and then do a AND/OR relation. Any ideas? Thanks
$args = array(
'post_type' => 'product',
'posts_per_page' => 100,
'paged' => $page
)
$data= new WP_Query( $args );
Please try like this:
You can go in this way. Get values of both your meta keys and store those values in your variables like ($a , $b respectively), then have a check on those values
Now comes the query section.
Give it a try it will work for you.
Note:
a, b and c
meta keys
andvariables
are just for example purposes, use your ownmeta key
andmeta values
to get results that suits you.