for single posts? I currently have a post with a title of "User Guide 2017" and a category with "User Guide 2017."

The title of the post is featured on the front page with a link created by the_permalink(). When a user selects the link, they are delivered to archive.php instead of single.php.

It appears the issue is connected solely to the identically named title and category as other posts featured on the front page will link to their full posts on single.php. Help please!

  • This is a common gotcha. You might look into changing your permalinks - if your single post is at example.com/%postname%/ you may need to change the permalinks to example.com/%category%/%postname%/ or example.com/%post_id%/%post-name%/ so WP knows you are asking for the single post rather than the category. – WebElaine Jul 17 '17 at 15:33
  • 1
    an important distinction that has deeper repercussions, is that it didn't choose archive.php to display the page with that title, but it showed a category archive instead. Which template is loaded is determined by what content is loaded, the content is decided before the template, not the other way around – Tom J Nowell Jul 17 '17 at 15:59
  • @TomJNowell Great point! I'll have to spend some time on this ... my mind is mush at the moment. – bresson Jul 18 '17 at 0:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.