WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 4 years ago

#10191 closed defect (bug) (duplicate)

WordPress not determining if a request is a 404

Reported by: sivel Owned by: ryan
Milestone: Priority: normal
Severity: normal Version: 2.8
Component: Permalinks Keywords:
Focuses: Cc:

Description

Using the default permalinks or when you have any other permalink installed, but request a post/page/cat/tag/author/archive using the default permalink style it will not correctly identify that a request to a post/page/cat/tag/author/archive that does not exist is a 404.

Due to this, numerous notices are generated from wp_title, get_body_class, comments_open, pings_open, feed_extra_links and many more.

Change History (7)

comment:1 Denis-de-Bernardy5 years ago

  • Component changed from General to Permalinks
  • Milestone changed from 2.8.1 to 2.9
  • Owner set to ryan

comment:2 sivel5 years ago

  • Cc matt@… added

comment:3 dcole075 years ago

Ticket 10486 is probably a dup of this one, but does a good job of giving more detail.

comment:4 janeforshort5 years ago

To close the dupe at 10486, pasting in dcole07's notes from that ticket here:

"There is something wrong with how WordPress desides whether to use the 404 template or not. There are a lot of cases where it uses other templates went there is not content.

How to reproduce: Install Wordpress 2.8.X Use the Default theme Go to ?p=404 or any made up page that isn't real. It doesn't go to the 404 template, which it should. It instead uses the single template, even though there is no content.

Themes can do a work-a-around by using an if/else statement and checking for content, but that's dumb, when we have a is_404() check. WordPress should default to using 404.php (if there is one) and make is_404() true before any template file is loaded.

If this is how the core developers want the 404 to work, then another template and template functions should be made, so people can have one template to manage URLs that don't have content."

"To summarize this problem, WordPress is able to find a template based on URL information, but it turns out to be the wrong template, because there is not content."

"I'll pick up this ticket or the one it's a dup of, if no one else will and someone is willing to mentor me or give feedback to my ideas. I'd like to suggest a solution, but I don't know enough about the WordPress template system at the moment... I'll look into it."

"I read though the WordPress code and it's not like the code has a bug, it's just lacking the feature to pickup on missing content. The problem with generating a solution for this "bug" is that we don't know there is no content until we're half way though the template it did match. What I don't get, is that this problem can be avoided with the right non-default permalink structure. So, does that mean we can patch this problem, so visitors don't use a template that doesn't have content available? I'm thinking we could check for content based on what the URL says it's going to be when WordPress is deciding what template to use and give a 404 if nothing is found... basically. We'd have to be careful, because some templates may be designed to not have content."

comment:5 westi5 years ago

  • Cc westi added

comment:6 lloydbudd4 years ago

  • Milestone changed from 2.9 to 3.0

comment:7 dd324 years ago

  • Milestone 3.0 deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Looks to be a duplicate of #12250

Note: See TracTickets for help on using tickets.