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 (6)
3 years ago
- Component changed from Rewrite Rules to Query
2 years ago
- Milestone Awaiting Review deleted
- Resolution set to wontfix
- Status changed from new to closed