Regarding the var_dump, “courses” isn’t showing up because the var_dump is running outside of any action. So it gets triggered before the “init” action runs, which is where the post type is registered.
Regarding the main loop, I pasted your code into the default Twenty Seventeen theme’s functions.php file, and added a course via the dashboard, and it showed up on the homepage for me.
Related Posts:
- Am unable to reset a query properly
- Get next and previous 3 posts in a term in single post page
- How can I group by Taxonomy on Custom Post Type while filtering out based on custom Meta
- Listing custom post type items from a couple of custom taxonomies
- Pagination not working with custom loop
- Display all posts in a custom post type, grouped by a custom taxonomy
- How to use a custom post type as front page?
- SQL to update custom post taxonomies
- Query multiple taxonomy in Custom Post Type
- Querying Posts by Taxonomy From Alternate Network Site
- Conditional two level dropdown filter for custom post type
- Show all custom post type posts sorted by custom taxonomy then by another custom taxonomy
- List all posts in Custom Post Type but group dynamically by Custom Taxonomies
- Randomly placed sticky custom posts complemented by blog posts
- Should unaltered default loop/query return a list of custom posts belonging to a custom taxonomy?
- 404 error PageNavi custom type taxonomy | wordpress
- Include different loop templates in search query
- Query for posts in 2 taxonomies
- Separate Posts and Custom Post Type in Custom Taxonomy archive template
- How to dynamically build a multiple taxonomy query loop within a post type’s single loop?
- Is it possible to create a shortcode that will query a post based on taxonomies?
- Show Two custom Post type and their posts on category page
- wp_query to find posts by year and month
- Querying Term Posts in Loop
- Custom Post Type Taxonomies -Posts not showing in Category or Tag pages
- Custom Post Type Loop within Shortcode
- get_template_part for each level of taxonomy term
- Filter by custom taxonomy slug on a custom post type
- Display CPT posts based on specific taxonomy
- WordPress Genesis custom taxonomy archive shows 3 repeats of each post
- get_attached_media() on author page not working
- Loop custom taxonomy to get lists of cutom post types?
- Making certain categories of CPT not publicly queryable
- Search / Filter posts on Title/Content OR Tags
- Show a Category X’s custom post type on Category X archive page?
- How do I move/order posts with a tag to the end?
- Display all taxonomy terms, add class if term applies to current post
- Return the latest post from a custom Taxonomy and Post Type
- Specific query for custom post type
- Full Custom Post Type List Organised by two Taxonomies
- Display post content with respect to its title?
- WP_Query orderby and tax_query
- I am trying to hide a custom post type category to logged in users with Pre_Get_Posts
- Listing all term items alphabetically / sorting loop
- Only show posts with date of today or in the future (i.e don’t show past posts)?
- Custom Post Type Category Link
- Custom Post type category pages template and loop
- Three Most Recent Posts, One Per Term
- Control content before and after custom post type loop
- Dynamically insert code to custom post type loop
- Pull in taxonomy field of custom post type in new query
- display posts of custom post type with custom taxonomy
- My custom taxonomy is only displaying 1 of 3 terms
- Custom Post Type and Taxonomy Loop Output Is Wrong
- Custom taxonomy query showing more than 4 posts
- Compare Two Custom Post Types Using The Same Custom Taxonomy
- Query Custom Post by taxonomy multiple categories
- Cant’ Display Custom Post Type Title Base on Tax Terms
- Custom Post type showing up in loop, regular posts are not showing up
- Loop for custom-post-type comparing taxonomy terms for “related” posts?
- How do i display post from a taxonomy term?
- What is the most efficient way to execute recursive complex queries?
- How can I loop at a Specific Taxonomy from a custom post type?
- Get Posts List of Current Selected Custom Taxonomy in Shortcode
- How to divide Subcategories into pages of parent category wordpress
- How to display list of custom post taxonomy terms and their posts (if any)?
- Update query based on CPT / Post Type, show all sorted by date
- Is there a way to use ‘publicly_queryable’ => false only on specific taxonomy term?
- Shortcode with loop stacks output
- Displaying all posts by category and showing content on click
- Excluded Custom Taxonomy Term Posts Displaying in loop
- Some posts not displaying by taxonomy term
- WP_Query for custom taxonomies showing posts from non-specified terms?
- posts_per_page is not working by term
- % encoded URL giving 404 error in WordPress
- CPT: multiple loops with different terms
- Display title of all custom posts from same taxonomy term on a custom post template
- Add active class to foundation 6 tabs while looping categories
- Looping through custom taxonomy in one template
- WordPress query posts by custom post type not workng
- Get posts of an specific term of a custom taxonomy
- Is it possible to add query parameters on the archive page?
- Custom taxonomy page template
- Loop with Custom Post Type and Taxonomies
- WordPress Custom Post Type and sort by Tags
- Display posts from category in page
- Query Only Show Text on Posts With Certain Taxonomy Tag
- Order by custom field attribute
- Display Custom Taxonomy of custom post type
- Pagination not working with custom loop
- how to limit query_post to first page?
- Sorting custom post types by taxonomy (So close)
- Pagination not working with custom loop
- Pagination not working with custom loop
- Looping taxonomy in taxonomy?
- Pagination not working with custom loop
- Catergory args causing loop not to show
- Complex Custom Loop with Includes
- Create a WordPress loop that shows posts from a custom post type + filters the posts by taxonomies while hiding empty taxonomies
- Add Custom Taxonomy Terms as CSS Classes for CPT Posts in an Elementor Loop Item Template