Skip to content

Instantly share code, notes, and snippets.

@ajskelton
Created April 6, 2020 15:36
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 ajskelton/b358fa7e58c303314f7b2fe962a651f8 to your computer and use it in GitHub Desktop.
Save ajskelton/b358fa7e58c303314f7b2fe962a651f8 to your computer and use it in GitHub Desktop.
Test for pages using a specific Page Template
function test_for_page_template() {
$args = array(
'post_type' => 'page',
'meta_query' => array(
array(
'key' => '_wp_page_template',
'value' => 'PAGETEMPLATE.php'
)
)
);
$query = new WP_Query( $args );
dump_and_die($query);
}
add_action('init', 'test_for_page_template');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment