WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#12918 closed defect (bug) (fixed)

Register default post types before plugins and themes are loaded

Reported by: ryan Owned by:
Milestone: 3.0 Priority: normal
Severity: normal Version:
Component: Posts, Post Types Keywords:
Focuses: Cc:

Description

Although correct behavior is to wait until init has fired to do anything, many themes call get_pages() prior to init. If the default post types have not been registered yet, get_pages() will fail because the "page" post type is not present. We can work around this in the same manner as we did for taxonomies by calling create_initial_post_types() before loading plugins and themes.

Attachments (1)

12918.diff (667 bytes) - added by ryan 4 years ago.

Download all attachments as: .zip

Change History (4)

ryan4 years ago

comment:1 nacin4 years ago

Works for me. Closing #12873 as a duplicate.

comment:2 ryan4 years ago

Wow, my search for existing tickets on the issue was obviously a failure. :-)

comment:3 ryan4 years ago

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

(In [14041]) Call create_initial_post_types() before plugins and themes are loaded so that premature post API calls don't fail. fixes #12918

Note: See TracTickets for help on using tickets.