Opened 6 years ago
Last modified 5 years ago
#45737 new enhancement
Starter Content: Add support for terms and taxonomies
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Future Release | Priority: | normal |
Severity: | normal | Version: | 4.9 |
Component: | Customize | Keywords: | |
Focuses: | Cc: |
Description
Starter content has been a great tool not only for themes to showcase what they can do, but for some interesting work around custom onboarding flows that reduce the difficulties of getting started for various groups of new users. As work around these things matures though, it's starting to push against the boundaries of what starter content currently supports.
I'd like to see support added for terms. They could work similar to how nav menus, featured images, etc work, allowing terms to be added and a symbol referencing them to be added to the post.
<?php [ 'posts' => [ 'blog-post' => [ 'post_type' => 'post', 'post_title' => 'Blog post', 'post_content' => 'Lorem ipsum', 'term_ids' => [ '{{foo-category}}' ], ], ], 'terms' => [ 'foo-category' => [ 'name' => 'Foo', 'slug' => 'foo', 'taxonomy' => 'category', ], ], ]
Change History (4)
#2
@
6 years ago
- Version changed from 5.0 to 4.7
Using terms in starter content is currently blocked by #37914. Starter content for posts works by means of creating posts with the auto-draft
status so that they are invisible to the site unless the changeset is published, at which time the statuses get transitioned to publish
; otherwise the posts are garbage-collected if the changeset is never published. There is no such concept for terms yet (i.e. term_status
), so creating such a shadow term is difficult.
See also #37915 which is about drafting taxonomy terms for nav menu items.
This is in the same vein as #40807, although obviously not the same. Having said that, I wonder if it might make sense to talk about whether we should allow hooking into
WP_Customize_Manager::import_theme_starter_content()
some to allow custom extension? You can filter the starter content usingget_theme_starter_content
to add custom content, but there's no real way to process that custom content aside from hooking another function intoafter_setup_theme
which would work if what you want to do is really stand alone, or unhookingWP_Customize_Manager::import_theme_starter_content()
and doing your own thing completely.Any thoughts @westonruter ?