Opened 10 years ago
Closed 9 years ago
#39610 closed defect (bug) (fixed)
Customize: Custom post types cannot be used in starter content
| Reported by: | westonruter | Owned by: | westonruter |
|---|---|---|---|
| Priority: | normal | Milestone: | 4.7.3 |
| Component: | Customize | Version: | 4.7 |
| Severity: | normal | Keywords: | has-patch has-unit-tests commit fixed-major |
| Cc: | Focuses: |
Description
As reported by @tiagonoronha:
hi! I noticed that custom posts types cannot be used in Starter Content. CPTs are registered in the
inithook, way after starter content is loaded inafter_theme_setup. Is this a known issue? thanks!
and:
Hi! Well, they literally cannot be used in any way. Adding a post of a CPT in starter content gives me a warning in the customizer. I’m testing this with WooCommerce that registers the CPTs on
init. This is not a problem with the default post types because they get registered two times, inwp-settings.phpand then again on theinithook.
Attachments (3)
Change History (13)
#3
@
10 years ago
A fix also was needed in Customize Posts to prevent a warning from being triggered: https://github.com/xwp/wp-customize-posts/pull/340
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
The problem is that
\WP_Customize_Nav_Menus::insert_auto_draft_post()was doing apost_type_exists()check and bailing. It's clear that for the purposes of this API method there needn't be a post type existence check, especially in the case of importing starter content. Note thatpost_type_exists()check is still present inWP_Customize_Nav_Menus::ajax_insert_auto_draft_post()and so the check was actually redundant.