get_queried_object() is your friend. It will tell you all kinds of information about what your template files are trying to do. From within, you can discover your post type. Try doing a var_dump
to take a look at that object.
As for your second question, taxonomy is not, as far as I know, isolated to one post_type, so that is not really something one can assume. For example, “location” may be a taxonomy to both post types: “Restaurants” and “Grocery Stores”.
Related Posts:
- Filtering a custom post type by custom taxonomy in archive template
- Permalink Structure for Multiple Post Type Archives by Taxonomy
- get term archive url / link
- Pagination throws 404 error on custom taxonomy archive pages
- Archive page with multiple taxonomies rewrite
- Create permalink structure for one taxonomy archive per custom post type
- Pages, Custom Posts & Custom Taxonomy defining slug structure
- How to show a tag archive of one post type only
- Custom taxonomy archive page not working
- How to show multiple post types on taxonomy archive?
- Disable single pages and archives and keep preview
- How to create archive page for taxonomy terms within custom post type
- Category and post tag archives do not include posts from custom post type
- custom taxonomy archive by year
- Display custom post type taxonomies as an archive page
- Archive page for taxonomy terms
- Custom Post Type Archive Page Filtering
- Root slug of taxonomy returning 404
- Create template for taxonomy results limited by Custom Post Type
- How do I check if the user is on a taxonomy term parent, child or grandchild page?
- Custom post type / taxonomy rewrite archive page 2 gives 404
- How can I get this request to use the Custom Post Type page template instead?
- Archive for a Taxonomy of a Custom Post type
- What’s the name of the custom post type yearly archive template?
- Custom Post type & Taxonomy 404
- Taxonomy archive 404ing (not term archive)
- Custom taxonomy or custom page templates?
- Dynamically insert an article at the top of a taxonomy archive – or?
- Only show posts with a specific term of an associated taxonomy in a custom post type archive
- Use the custom post type archive for taxonomies?
- How to rewrite custom taxonomy term archive to use THE SAME SLUG/front as CPT
- Get the link of the first post of a custom taxonomy in a custom taxonomy list
- Archive page for custom post type and custom taxonomy
- Advanced archive url structure (category, tag and date)
- How can I tell if I’m on a custom post type archive page?
- Custom Post Type Archive Page showing as 404
- Set up Custom Taxonomy Archive Template File To Cover 3 Categories
- How to show custom post count in archive page
- Order archive custom posts by taxonomy term [duplicate]
- Custom category taxonomy – archive page not showing up
- Custom post type URL structure with site.com/custom_taxonomy_slug/post_name
- Custom taxonomy archive slug overwrites static page
- Custom Post Type tag taxonomy “Page Not Found”
- archive-{custom_post_type}.php not getting recognized wordpress
- Archive.php is not displaying tags
- How to display custom post types AND regular posts separately on a shared taxonomy archive?
- Taxonomy Query of Custom Post Displays Archive Instead of Posts
- How to have a dynamic slug and rendering the archive-{post_type}.php?
- Show custom category archive as front page and remove taxonomy slug from urls
- Check if a custom taxonomy archive page is being displayed
- How to limit the number of terms (terms acts like categories)
- Semantic URL Custom Post Type and Taxonomies permalinks
- Displaying Posts Related to Other Posts by a Taxonomy Term?
- Add custom taxonomy to custom post type
- Change plugin’s has_archive = true to false?
- Is slug “type” reserved and can’t be used in taxonomy rewrite?
- wp_query to find posts by year and month
- How to display selected taxonomies by their parent
- Get template part using a custom taxonomy term
- Get archive post type name
- How to restrict users and admin from creating new taxonomy terms?
- Displaying custom taxonomy in the admin list of a custom post type
- Custom Taxonomy terms aren’t getting referenced or saved in Quick Edit or Bulk Edit, only on Single product page?
- How do I move/order posts with a tag to the end?
- Get taxonomy values based on wp_query results
- Custom WP Query on custom meta and sort by multiple meta keys value
- Several CPT’s with same Taxonomy name but with different Terms for each
- Including taxonomy term before post type breaks top level pages
- Correct procedure for advanced permalinks
- Permalinks: custom post type -> custom taxonomy -> post
- Plugin fatal error
- Is there something like has_no_term
- Which Template Page Should I Use?
- I can’t access custom taxonomy page listing
- Should I use custom taxonomies or not?
- List of Categories for Custom Post Type
- Attaching a Custom Taxonomy to Posts?
- display custom taxonomies limited to custom post type?
- Reordering admin columns for CPT with custom taxonomy and an added custom field
- The Difference Between Categories and Tags and Taxonomies and Terms
- Category Search / Custom Post Type search on my website. Custom Post Types that are “page-like”?
- Custom Post Type and Taxonomy Loop Output Is Wrong
- Display registerd taxonomy in admin dashboard
- “Cannot redeclare cpt_reg_tax()” because of functions.php
- custom taxonomy listing returns no posts
- WP_Query order custom post type with certain meta key value by post modified date
- Cant’ Display Custom Post Type Title Base on Tax Terms
- Writing a custom Glossary plugin
- How to achieve a multi-taxomony layout with posts?
- How to show Custom Post Types under Taxonomy in a new WordPress page template?
- Displaying all posts by category and showing content on click
- How to search through all child taxonomies using WP_Query?
- Custom post type and custom taxonomy key lenght & query performance
- Change the term based on the value of a $variable using wp_update_post in submitting a form
- Custom permalink with custom taxonomies for custom post type
- Site loads very slow for archive custom post type page
- Show custom taxonomies in admin panel under custom post type
- Plugins for putting Custom Post Types into the Menu
- Display associated taxonomy child name on single CPT page
- Dynamically count the number of custom post types associated to a custom taxonomy