Opened 9 years ago
Closed 9 years ago
#39610 closed defect (bug) (fixed)
Customize: Custom post types cannot be used in starter content
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 4.7.3 | Priority: | normal |
| Severity: | normal | Version: | 4.7 |
| Component: | Customize | Keywords: | has-patch has-unit-tests commit fixed-major |
| Focuses: | Cc: |
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
@
9 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
This ticket was mentioned in Slack in #core-customize by westonruter. View the logs.
9 years ago
#7
@
9 years ago
- Keywords commit added; needs-testing removed
- Owner set to westonruter
- Status changed from new to accepted
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.