WordPress Query where meta field is not set / doesn’t exist

By North Street, A Creative Studio

Sometimes you need to search for a meta field that doesn’t yet exist. If that’s the case, this is the secret:

			'meta_query' => array( 
				'relation' => 'AND',	                	
				array(
					'key' => 'resource_type',
					'value' => '', // empty field required!
					'compare' => 'NOT EXISTS' // works!
				),
			)

http://wordpress.stackexchange.com/questions/80303/query-all-posts-where-a-meta-key-does-not-exist

About north street

We engineer the thoughtful transformation of great organizations. Our proven process helps us understand what your competitors are doing right — and wrong. Want to learn more? Let’s chat.

More Notes

A bowler hat with radio waves behind it

From Layoff to Leadership: Tom Conlon’s Journey to a Prosperous Business

Welcome to Your 2024 Branding Pep Talk

A bowler hat with radio waves behind it

CEO Tom Conlon talks shop on Podcast Marketing Secrets