index.php
is not the template for the homepage, it’s the fallback template. Right now every page you load is falling back to the catch all index.php
template, but your index.php
doesn’t have a main loop, and isn’t set up as the fallback catch all template. Instead it’s doing its own new query and displaying the results.
So no, you’re not being redirected to the homepage, rather, you’re displaying the homepage on every page. Move your homepage code into a homepage template, e.g. home.php
or a page template called home. index.php
should be the last resort fallback, with a generic main loop.
I recommend you take a look at the template hierarchy to see how WordPress decides which template to load, and what you can implement
Related Posts:
- How to switch from custom post type URL to category URL?
- Hierarchical taxonomy in permalink structure
- Is it possible to have public posts in a non-public custom post type?
- How can I add a “fake” parent into the permalink?
- Custom Post Type + Category archive
- Custom Post Type with /%shop_name%/gallery/%gallery% permastruct?
- Remove sequential number from permalinks
- Multiple Custom Post Type permalink issue
- Permalink of custom post type partly broken
- Custom Post Types and rewrite rules – One CPT works and a cloned one doesn’t
- Permalinks when using Custom Post Type with static page for archive
- How to change permalinks to taxonomy and post type’s posts
- Custom Post Type Archive Links Not Working
- Custom Post Type Categories Not Maintaining URL structure any more
- Customizing the custom post type permalink
- How to retrieve the permalink for a specific (custom) term?
- Add category slug as class attribute in a link array
- Have two (permalinks) urls for a same custom post type
- change precedence of permalink for post_types?
- Custom post type child page 404
- Single page problem when permalink type changed
- Remove Custom Taxonomy Slug only without removing Custom post type slug in permalinks
- Redirect permalinks after creating custom post types
- taxonomy term names in custom post type permalink structure
- Get post id of permalink for a specific custom post type?
- Permalink clashing with Custom Post Type rewrite rule
- Can’t make permalink of CPT work
- Custom Post Type Permalink
- Issue with permalinks for custom post type
- Adding 2 CPT with multiple custom taxonomies to permalinks
- Custom Post Type permalink not working on new posts
- URL Rewrite Adjustment for Custom Post Type causes template to revert to index.php
- Parent cpt/child custom post type URL permalink relationship
- Custom post type using standard post categories results in 404 when viewing /cpt/category
- How to make nested custom post type slugs work
- Permalink Trouble with Custom Post Type
- Custom Post Type Permalinks Problem
- Problems with custom post type and hierarchical permalinks
- WordPress Custom Permalink Structure with Custom Post Type and Taxonomies
- Change Taxonomy Permalinks
- Cross post type parent page added parent page to permalink but give 404
- Add taxonomy to custom post type archive
- Category / Custom Post Type permalink issue
- Storing postID in session variable to query database when visitor on custom template page
- Adding rewrite rules to Custom Post-type mixed with Taxonomy
- What is the proper way implement a global $wp_rewrite?
- Is it possible to remove the word “date” from archives?
- “regular” pages not found after changing permalink
- Can’t preview custom post – Redirected to home page
- Custom Post Type – Rewrite slug [duplicate]
- Custom Post Type Permalinks with %category%
- Custom Post Type and Taxonomy pagination permalink
- permalink structure for single-{post-type}.php in wordpress
- Custom post type – permalink
- How can you preserve URLs when moving posts to a custom post type?
- Linking from a list of custom post type items to a single – get_post_permalink not working correctly
- Custom post types not using archive structure
- Custom Post Types and 404 Pages
- Permalinks Works for Custompost type but not with pages Why?
- Permalink for regular posts “/blog/”
- Custom role can’t create permalink
- Custom post types permalinks not working
- Rewrite rules for using the same base slug for multiple content types
- Problem with Custom Post Types, Taxonomy, permalink, Archive
- Permalink for Custom Post Types
- Dynamically change Custom Post Type Template OR Change Permalink?
- Custom post type permalink structure
- How do I use CPT and permalinks with a mobile theme?
- Change permalinks for posts but not custom post type?
- Posts picking up old Permalinks, how to reset?
- Remove slug from Custom Category Permalink + dual-category permalinks
- WordPress Set A Static Page/Template For All Sub-Pages
- Single and Archive Pages with Custom Post Type
- How to have a dynamic slug and rendering the archive-{post_type}.php?
- Add /blog to the “post” post type url
- Custom post type and category permalinks
- PHP Button Custom link [closed]
- 404 Error On Custom Taxonomy Pages 2, 3, etc
- Wp-theme Development
- Can I have a specific template for products even if they are standard posts and not CPT?
- Get permalink in custom post type loop doesn’t work
- Custom Post Type, 404 error
- Custom post type, when type non existing post name, it query the nearest possible post name by default. How can I disabled this behavior
- How to add custom permalink struct with DYNAMIC author to a Custom Post Type
- Custom post type split title, setup permalink accordingly
- How to get permalink of post based on post name?
- Different CPT permalink base on taxonomy
- When Attempting to Filter Plugin Generated Content Using Filter post_type_link, Permalinks Are Not Modified
- Hide custom post type slug url from search engine [closed]
- Multiple custom post type in URL
- Custom post type Premalinks main page and details page
- Two Permalinks with one Taxonomy (custom taxonomy) and (custom post type -> custom taxonomy)
- Is it possible for post and custom post type to share a category base slug?
- Custom post type with custom parent prefix slug
- What is the best way to relate different custom post types?
- Replace the custom post type permalink
- Modify permalink of CPT archive to support two taxonomies
- Permalinks for Custom Post Types and Taxonomies
- Have Custom Taxonomy Slug Fall Under Custom Post Type Slug
- Allow child pages with the same base as the CPT slug