Connect General Post & Page Category Type & Status Password Author Search Pagination Order Taxonomy Overview Use this tool to create custom code for WordPress Query with WP_Query class. Usage Fill in the user-friendly form. Click the “Update Code” button. Copy the code to your project. Examples If you are still learning how to use this tool, check out the following examples: Query Variable Name The variable used in the code. Show The Loop No Yes The post type name/slug. Used for various queries for post type content. Text Domain Translation file Text Domain. Optional. Post ID Display post by ID. Post Name Display post by slugs. Page ID Display page by ID. Page Name Display page by slugs. Parent Display child-pages of a parent-page id. Category ID Display post by category id. Category Name Display post by category slug. Can also insert multiple slug. Single string or comma seperated. e.g. staff,news Multiple Category ID Display posts that are in multiple categories. e.g. 1,2 Exclude Category ID Exclude posts by multiple categories. e.g. 1,2 Post Type Display posts by post type. Post Status Display posts by post status. Has Password No Yes Display password protected posts. Post Password Display posts with a particular password. Author ID Display posts by author ID Author Name Display posts by author 'user_nicename'. Author ID In Display posts from multiple authors. Enter Multiple id coma seprated. e.g. 1,2 Author ID Not In Exclude posts from multiple authors. Enter Multiple id coma seprated. e.g. 1,2 Search Keyword Display post by keywords. Use Pagination No Yes Show all posts or use pagination. Paged Show posts in page number X. Posts per page Number of post to show per page. Posts per archive page Number of post to show per archive page. Sticky Post No Yes Show or ignore sticky posts. Offset Number of post to displace or pass over. Order Choose.. ASC DESC - Default Ascending or Descending order. Order by Choose.. None Random ID Title Slug Date - Default Modified Date Parent ID Menu Order Comment Count Sort retrieved posts by. Show Tax Relation No Yes Whether to show or hide Tax Query Tax Relation Choose... AND (default) OR The MySQL keyword used to join the clauses of the query. Taxonomy Taxonomy being queried (e.g. category, post_format, movie). Terms Term or terms to filter by. Single string or comma seperated. Field Choose... term_id (Default) slug name term_taxonomy_id Field to match terms against. Operator Choose... AND IN (Default) NOT IN EXISTS NOT EXISTS MySQL operator used with terms in the WHERE clause Taxonomy Taxonomy being queried (e.g. category, post_format, movie). Terms Term or terms to filter by. Single string or comma seperated. Field Choose... term_id (Default) slug name term_taxonomy_id Field to match terms against. Operator Choose... AND IN (Default) NOT IN EXISTS NOT EXISTS MySQL operator used with terms in the WHERE clause Taxonomy Taxonomy being queried (e.g. category, post_format, movie). Terms Term or terms to filter by. Single string or comma seperated. Field Choose... term_id (Default) slug name term_taxonomy_id Field to match terms against. Operator Choose... AND IN (Default) NOT IN EXISTS NOT EXISTS MySQL operator used with terms in the WHERE clause Taxonomy Taxonomy being queried (e.g. category, post_format, movie). Terms Term or terms to filter by. Single string or comma seperated. Field Choose... term_id (Default) slug name term_taxonomy_id Field to match terms against. Operator Choose... AND IN (Default) NOT IN EXISTS NOT EXISTS MySQL operator used with terms in the WHERE clause Update Code // WP_Query arguments $args = array( ); // The Query $query = new WP_Query( $args );