Created
March 23, 2022 08:22
-
-
Save carlaizumibamford/ba7b5fc210c184c903e192785c22159d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Display only pages: | |
$query = new WP_Query( array( 'post_type' => 'page' ) ); | |
Display ‘any‘ post type (retrieves any type except revisions and types with ‘exclude_from_search’ set to TRUE): | |
$query = new WP_Query( array( 'post_type' => 'any' ) ); | |
Display multiple post types, including custom post types: | |
$args = array( | |
'post_type' => array( 'post', 'page', 'movie', 'book' ) | |
); | |
$query = new WP_Query( $args ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment