is_home returns true for pages created with custom rewrite_rules
|Reported by:||LucasMS||Owned by:|
I have a plugin for question and answers, where the questions index and question pages are created using add_rewrte_rule . (I know I could do something similar using custom post types, but this plugin was done long before this feature).
here are my rewrites called in init hook:
add_rewrite_rule('^questions/([^/]+)/?', 'index.php?questions_category=$matches', 'top'); add_rewrite_tag('%questions_category%', '([^&]+)');
The problem is, in the header of the template I use is_home() to load some custom codes, but is_home() is returning true in theses question pages.
Tthese pages are not of any wordpress type (post, page, 404, home, archives - tax, dates, categories and so on). My suggestion is to create a new is_dynamic boolean variable for this kind of pages.
Change History (5)
comment:1 SergeyBiryukov — 5 months ago
- Component changed from Rewrite Rules to Query
comment:2 wonderboymusic — 4 months ago
- Milestone Awaiting Review deleted
- Resolution set to wontfix
- Status changed from new to closed