If this is the main query, you shouldn’t be creating a new query at all, just run the normal loop and you will see the posts from your CPT.
The reason your custom query isn’t working is that post-type
is not a valid parameter, it’s post_type
(underscore, not hyphen).
If your goal is to ultimately change the sort order of your CPT archive, then you’re in the wrong place, nothing needs to be added to the template page, instead you should be adding a function hooked to pre_get_posts
to alter the parameters of the main query.
Related Posts:
- How to use a custom post type archive as front page?
- How to set a custom post type to have viewable future posts
- How to get_queried_object on multiple objects?
- is_main_query() not working for WP REST API
- WP_Query | ‘post_type’ doesn’t work
- Query Posts that have Custom Taxonomy
- Make Next and Previous on single-$posttype.php use the same order as archive-$posttype.php
- Tell wordpress to show a single page instead of an archive page
- Only show categories that have posts within custom post type
- Custom Post Type shows pagination (w/404) or posts_per_page query, but not both
- why custom post archive gives always no more than 10 posts despite of paging settings?
- Display custom post type category, while in a CPT category, then the posts beneath
- WP_Query inside foreach loop returning same value for all options when filtered using ajax
- Mixing 2 custom post types with posts output in specific pattern
- Custom post taxonomies as tax_query terms?
- creat filter with wp_query
- Troubles with acf/save_post and WP_Query
- A method for ordering mixed dates in search result loop (theory only, no actual code)
- Query custom post type with ACF Date
- How to do WP_Query with two meta fields with orderby clause
- Stuck in Order by more then one
- Display featured image from one CPT within another CPT query
- Custom WP Query on custom meta and sort by multiple meta keys value
- Show only one post on custom post type archive
- Woocommerce search pagination not working
- How to order WP_Query by parent for hierarchical Custom Post Type?
- Including metaboxes from custom post types in global search — continued
- WordPress loop: Show only a Custom Post Type Taxononmy TERM
- How can I made custom taxonomies relationship?
- Query Multiple Custom Posts by Custom Fields
- What’s the WP way to load remaining custom posts?
- Why is this query not working? (Standard posts + custom post type)
- How do you paginate a query grouped by month?
- Custom taxonomies relationship
- Get Posts by multiple custom fields is not working
- Single post with a Custom Post Type returns 404, when archives of the CPT work correctly
- CPT archive admin menu label
- Custom post type ‘articles’ ignores posts_per_page, reserved post_type?
- Several post types on WP Query by tag and taxonomy
- Number of Custom Post Types published are not being shown in the custom page
- WP Query with categories only shows one post and ignores the category
- Polylang non-default language ignores tags in WP_Query
- WordPress request fiter order by related post’s post_title
- Custom post type archive page blank
- Custom Widget WP_Query problem
- Custom query at top of archive search page, arguments are overridden
- Order Custom Post Type by Custom Field Value
- WP_Query custom post type query not showing the exact post type
- Custom Post Type has_archive
- How to display post list inside post
- Custom Post Type Archive URL is wrong
- Pagination issue on category.php using custom post type query
- Creating a Custom Post Type
- How to have this permalink structure: post_type/postname/custom_inner_page
- Problem: wp_query outputs all images on site
- Query Custom Post Type Taxonomy term with multiple parameters
- Custom Post Type slug same as page name
- How to display custom post in archive section of the wordpress page?
- Content Editable CPT Archive?
- Sort entries by date mixing two post types
- list archives per post types
- Why is my category template ignoring post type?
- First custom field value (out of several) displayed twice after query
- wp_reset_postdata() and wp_reset_query() inside shortcode are not working to reset original page query
- Prioritize posts in query by meta keys?
- Canonical url differs from custom post type archive URLs
- Change sort order when using ‘orderby’ => ‘type’
- Display a custom posts page for post type
- Custom post type archive pagination 404
- Add Custom Post Type of specific Custom Taxonomy to regularly blog loop
- posttype/taxonomy/term archive page 404 error
- How to get all tags of a custom post type by id
- Is it possible to have a custom post type with feed but without the archive?
- Filter Posts from the Main Query
- WP_Query orderby and tax_query
- Configuring a meta query with multiple post types that have the same relationship on a single page
- Different Ways to Query Custom Post Types?
- Order posts by 2 custom fields and if one custom field is zero orderby another custom field
- Pagination with custom query, custom search form, single and pages, ajax and no plugins
- Possible to filter custom post type with multiple meta data?
- Ignoring slug capitalization on rewrite rule for custom post type archive page
- can these 3 queries be re-written as 1 query?
- Advanced search form with filters for custom taxonomies
- How does order=asc effect a wp_query (its acting pretty weird in a loop)
- Paginate_links in custom post type template
- custom post type search by reference id
- pagination not working for category.php (custom post types in categories)
- Query based on custom fields start and end date
- Why is my WP_Query outputting my entries twice?
- How to display Related Posts based on number of taxonomy terms matched
- Retrieve custom post types by custom taxonomies with WP_Query
- My archive-posttype.php template is not loading
- Custom Post Archive is not working
- Showing specific post in order of array wp_query
- Add ‘last’ class to second post in featured post loop
- WP the_posts() on single-cars.php get category link
- tax_query not working in template
- cannot override post_types in WP_Query()
- Wrapping x posts in html without leaving empty html
- Limiting posts_join, where, etc to a specific WP_Query object?