WordPress.org

Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#2057 closed defect (bug) (fixed)

Pages with page-linked attachments can't be updated.

Reported by: skeltoac Owned by: ryan
Milestone: Priority: high
Severity: major Version: 2.0
Component: General Keywords: cache bg|has-patch bg|commit
Focuses: Cc:

Description

get_post() places pages in $post_cache and ignores the page cache. Therefore a get_post($page_ID) subsequent to a wp_insert_post($page) will return the page object cached by the get_post() call in wp_insert_post(), which was prior to the UPDATE query. This results in an UPDATE reverting the page when saving pages that include links to attachment pages.

What a mouthful.

This patch makes get_post() detect pages and pass their handling to get_page(). Likewise, get_page() is made aware of non-pages and passes their handling to get_post(). This makes the two functions interchangeable and keeps the two caches separate.

Attachments (1)

a-separate-cache.diff (1.8 KB) - added by skeltoac 9 years ago.

Download all attachments as: .zip

Change History (3)

@skeltoac9 years ago

comment:1 @ryan9 years ago

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

(In [3289]) get_post(), get_page() fixes from skeltoac. fixes #2057

comment:2 @anonymous8 years ago

  • Milestone 2.0 deleted

Milestone 2.0 deleted

Note: See TracTickets for help on using tickets.