Make WordPress Core

Opened 3 months ago

Last modified 3 months ago

#40807 new enhancement

Starter content: Allow for setting a "parent" for pages (and other hierarchical CPTs)

Reported by: webmandesign Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 4.7
Component: Customize Keywords: needs-patch
Focuses: Cc:

Description (last modified by westonruter)

From what I can see in get_theme_starter_content() function, it only allows for specific fields to be set for posts: post_type, post_title, post_excerpt, post_name, post_content, menu_order, comment_status, thumbnail and template.

I would like to propose adding a parent field in there too for hierarchical post types, such as Pages.

That way we can also create child pages (or sub-pages) in starter content, such as:

$starter_content = array(

  'posts' => array(

    'contact' => array(
      'template' => 'page-templates/list-of-child-pages.php',

    'contact-dublin' => array(
      'post_type'    => 'page',
      'post_title'   => 'Dublin Office Contact',
      'post_content' => 'Page content here...',
      'parent'       => '{{contact}}', // <-- Here's the magic:
                                       //     Making this a child page of our "Contact" page.



Thanks for consideration!

Change History (1)

#1 @westonruter
3 months ago

  • Description modified (diff)
  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to Future Release
  • Version changed from trunk to 4.7

Good call. Yes, this makes great sense.

Note: See TracTickets for help on using tickets.