WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 7 months ago

#39149 new defect (bug)

starter-content options limited to some names?

Reported by: Looimaster Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.7
Component: General Keywords:
Focuses: Cc:
PR Number:

Description

I just installed WordPress 4.7 and put this in the functions.php file:

function my_setup() {
	add_theme_support( 'starter-content', array(
		'options' => array(
			'show_on_front' => 'page',
			'test123' => 'test',
		),
	) );
}
add_action( 'after_setup_theme', 'my_setup' );

The fresh_site option was added to the database automatically with value of 1.

In footer.php when I run echo get_theme_starter_content(); I get the correct result but when I run echo get_option('test123'); right next to it I'm only getting false. With echo get_option('show_on_front'); I get expected page instead of default posts.

I tried to debug that but I can’t figure out what this is supposed to do preg_match( '/^{{(?P.+)}}$/', $value, $matches ) in import_theme_starter_content()?

I also noticed that all arrays need to be serialized which was kind of unexpected:

add_theme_support( 'starter-content', array(
	'options' => array(
		'test123' => 'test',
		'test1234' => maybe_serialize( array(
			'something' => 'test',
		) ),
	),
) );

Change History (0)

Note: See TracTickets for help on using tickets.