Comments on: How to filter custom post type by meta field https://pluginrepublic.com/how-to-filter-custom-post-type-by-meta-field/ WooCommerce Plugins Tue, 04 May 2021 10:19:07 +0000 hourly 1 By: Jomac https://pluginrepublic.com/how-to-filter-custom-post-type-by-meta-field/#comment-14422 Tue, 06 Nov 2018 03:40:13 +0000 https://pluginrepublic.com/?p=2692#comment-14422 Looks like you need one more check to make sure you’re editing the correct query (I got caught out by this), otherwise great!

if(isset( $query->query[‘post_type’] ) && $query->query[‘post_type’] == $post_type ) {

]]>
By: Ivan https://pluginrepublic.com/how-to-filter-custom-post-type-by-meta-field/#comment-6409 Mon, 19 Feb 2018 05:29:19 +0000 https://pluginrepublic.com/?p=2692#comment-6409 Hi Gareth!

Thank you for the information. It’s been really really useful.

I just had to change all $key’s for $value here:

<option value="” >

so the dropdown doesn’t show “0”, “1”, etc ($key), but the $value asociated to the $key.

]]>