0

I'm experiencing the weirdest bug:

I had a website working just fine, then it was assigned to me the task to create a new template. I created the template, everything working and tested ok, until I tried to refresh the permalink structure in Wordpress and BOOM!

All pages suddenly stopped working, WP instead of calling my custom template, it's calling the home/index.php file.

All templates are recognized in the dropdown while editing the page, but when I visit it, it's shown to me the home page, that's the issue.

Any advice?

EDIT: I needed to refresh the permalinks because some of the changes I made involved including new taxonomies type. I tried removing them, but the issue is still happening.

6
  • Can we see the code? We need more information
    – Tom J Nowell
    May 7, 2015 at 10:19
  • I don't know what could I show you really... I could paste here the template I created, but it's not that... I tried deleting it to see if things would work again, but no results.... Anything specific you would like to see?
    – lucaswxp
    May 7, 2015 at 10:22
  • Your taxonomies appear to be related to this, so anything related to rewrite rules. However, you say every page is using the index.php template correct? So all your taxonomies etc still work, they're just using the wrong template? Or is it just your page template? Or is it all page templates? Can you be clearer/more specific about what is and isn't working and how it's not working?
    – Tom J Nowell
    May 7, 2015 at 10:47
  • Hey Tom. All pages are using index.php, but other kind of "templates", like taxonomy/archive templates (the ones prefixed with taxonomy- or archive-), work ok.
    – lucaswxp
    May 7, 2015 at 12:58
  • Also, I tried renaming my template file to match exactly the page's slug, it didn't work. Also tried the combination "page-{$template}.php", no success.
    – lucaswxp
    May 7, 2015 at 12:59

1 Answer 1

0

So, after all, it was a wordpress bug apparently...

The problem is I was registering the following year taxonomy:

register_taxonomy('year', array('project'), array(
        'hierarchical'      => true,
        'labels'            => array('name' => 'Anos', 'singular_name' => 'Ano'),
        'show_ui'           => true,
        'public' => false
));

And it seems year is a reserved word for WP's rewriting rules, and it must have gotten confused because of this. I simply renamed the taxonomy and updated the permalinks and everything started working again:

register_taxonomy('project-year', array('project'), array(
        'hierarchical'      => true,
        'labels'            => array('name' => 'Anos', 'singular_name' => 'Ano'),
        'show_ui'           => true,
        'public' => false
));

I believe there must be other reserved names and the same problem might happen to register_post_type function too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.