Skip to content

Instantly share code, notes, and snippets.

@dboutote
Created June 11, 2018 16:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dboutote/98e7cb9280bf095342d5ff28ce7b4f93 to your computer and use it in GitHub Desktop.
Save dboutote/98e7cb9280bf095342d5ff28ce7b4f93 to your computer and use it in GitHub Desktop.
Querying content by a meta key
<?php
$args = array(
'meta_key' => '_affiliatedCompany',
'meta_value' => $companyID,
'post_type' => 'article',
'posts_per_page' => 20,
);
$r = new WP_Query( $args );
if( $r && $r->have_posts() ) :
// the loop
endif;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment