WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#3902 closed defect (bug) (fixed)

wp_title shouldn't use category_name if cat is also specified,

Reported by: majelbstoat Owned by:
Milestone: 2.2 Priority: normal
Severity: trivial Version: 2.1.2
Component: Optimization Keywords: category wp_title duplicate query optimisation has-patch commit
Focuses: Cc:

Description

A very simple patch. In wp_title(), we test to see if a 'cat' is supplied, generating a title based on that. The next block of code adds an unnecessary database call if 'category_name' is supplied, even if 'cat' was also supplied. We should just ignore the second block of code if we've already determined the cat title from the 'cat' var.

The patch simply adds 'else' to the second block. I can't think of any circumstances where this would be a problem. If the category_name and cat vars didn't map to the same title anyway, there would be bigger problems.

Attachments (1)

3902.diff (558 bytes) - added by majelbstoat 7 years ago.
Don't test category_name for wp_title is we've already tested cat

Download all attachments as: .zip

Change History (4)

majelbstoat7 years ago

Don't test category_name for wp_title is we've already tested cat

comment:2 ryan7 years ago

  • Keywords has-patch commit added

comment:3 ryan7 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [4976]) wp_title shouldn't use category_name if cat is also specified. Props majelbstoat. fixes #3902

Note: See TracTickets for help on using tickets.