Make WordPress Core

Opened 18 years ago

Closed 18 years ago

Last modified 15 years ago

#3430 closed enhancement (fixed)

wp_get_post_categories() to use $category_cache

Reported by: alexkingorg's profile alexkingorg Owned by: markjaquith's profile markjaquith
Milestone: 2.1 Priority: high
Severity: normal Version: 2.1
Component: Administration Keywords: has-patch 2nd-opinion
Focuses: Cc:

Description

...instead of querying the DB every time. Should check $category_cache for post id, and return if found, query if not found.

Per discussion here:

http://trac.wordpress.org/ticket/3427

Attachments (1)

wp_get_post_categories.diff (794 bytes) - added by markjaquith 18 years ago.
Patch for trunk

Download all attachments as: .zip

Change History (5)

#1 @alexkingorg
18 years ago

  • Type changed from defect to enhancement

#2 @alexkingorg
18 years ago

Note: helps with for backward compatibility with 2.0.x.

@markjaquith
18 years ago

Patch for trunk

#3 @markjaquith
18 years ago

  • Keywords has-patch 2nd-opinion added
  • Owner changed from anonymous to markjaquith
  • Status changed from new to assigned

Alex, Ryan, check the patch I uploaded. Instead of duplicating get_the_category code, I just called it in here. get_the_category returns a blank array, so that shouldn't be an issue for posts with no categories (or non-existent posts).

#4 @ryan
18 years ago

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

(In [4606]) Use get_the_category() within wp_get_post_categories() so that the cache is used. Props markjaquith. fixes #3430

Note: See TracTickets for help on using tickets.