{"action":"opened","issue":{"url":"https://api.github.com/repos/birgire/wp-combine-queries/issues/8","repository_url":"https://api.github.com/repos/birgire/wp-combine-queries","labels_url":"https://api.github.com/repos/birgire/wp-combine-queries/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/birgire/wp-combine-queries/issues/8/comments","events_url":"https://api.github.com/repos/birgire/wp-combine-queries/issues/8/events","html_url":"https://github.com/birgire/wp-combine-queries/issues/8","id":153644206,"number":8,"title":"Not working with custom post type","user":{"login":"Softid30","id":11415400,"avatar_url":"https://avatars.githubusercontent.com/u/11415400?v=3","gravatar_id":"","url":"https://api.github.com/users/Softid30","html_url":"https://github.com/Softid30","followers_url":"https://api.github.com/users/Softid30/followers","following_url":"https://api.github.com/users/Softid30/following{/other_user}","gists_url":"https://api.github.com/users/Softid30/gists{/gist_id}","starred_url":"https://api.github.com/users/Softid30/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Softid30/subscriptions","organizations_url":"https://api.github.com/users/Softid30/orgs","repos_url":"https://api.github.com/users/Softid30/repos","events_url":"https://api.github.com/users/Softid30/events{/privacy}","received_events_url":"https://api.github.com/users/Softid30/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-05-08T08:40:43Z","updated_at":"2016-05-08T08:40:43Z","closed_at":null,"body":"I've tried to used this a custom post type and it doesn't seem to work. It still shows the normal posts. Not sure what's wrong.\r\n\r\nmy code looks like this:\r\n$args1 = [\r\n    'post_type' => 'products',\r\n    'post_status' => 'publish',\r\n    'meta_query'     => [\r\n        [\r\n            'key'      => 'product_id',\r\n            'compare'  => 'EXISTS',\r\n        ],\r\n    ],    \r\n    'orderby' => 'date',\r\n    'order' => 'DESC',\r\n];\r\n\r\n//-----------------\r\n// Sub query #2:\r\n//-----------------\r\n$args2 = [\r\n    'post_type' => 'product',\r\n    'post_status' => 'publish',\r\n    'meta_query'     => [\r\n        [\r\n            'key'      => 'product_id',\r\n            'compare'  => 'NOT EXISTS',\r\n        ],\r\n    ],    \r\n    'orderby' => 'date',\r\n    'order' => 'DESC',\r\n];\r\n\r\n$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;\r\n//---------------------------\r\n// Combined queries #1 + #2:\r\n//---------------------------\r\n$args3 = [\r\n\t'posts_per_page' => 12,\r\n\t'pagination' => true,\r\n       'combined_query' => [        \r\n        'args'   => [ $args1, $args2 ],\r\n        'union'  => 'UNION',\r\n    ],\r\n   'paged'=>$paged,  \r\n];\r\n\r\n\r\n//---------\r\n// Output:\r\n//---------\r\n$q = new WP_Query( $args3 );"}}