Opened 12 years ago
Closed 12 years ago
#21755 closed defect (bug) (fixed)
wp_insert_post() cannot set a page template from the frontend
Reported by: | nacin | Owned by: | nacin |
---|---|---|---|
Milestone: | 3.5 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Themes | Keywords: | has-patch needs-testing |
Focuses: | Cc: |
Description
wp_insert_post(), when setting a page template with 'page_template', has a dependency on the get_page_templates() function.
Since WP_Theme is now available in wp-includes, we can use wp_get_theme()->get_page_templates(). Note that the keys and values are flipped, so we need to change from an in_array() to an isset().
Attachments (1)
Change History (4)
Note: See
TracTickets for help on using
tickets.
P2 was able to trigger this, it seems:
Not sure how this happened, though, because admin-ajax.php does include includes/admin.php, which includes includes/theme.php.