WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 months ago

Last modified 4 months ago

#39149 closed defect (bug) (worksforme)

starter-content options limited to some names?

Reported by: Looimaster Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.7
Component: Themes Keywords:
Focuses: Cc:

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 (3)

This ticket was mentioned in Slack in #core by noisysocks. View the logs.


4 months ago

#2 @poena
4 months ago

  • Resolution set to worksforme
  • Status changed from new to closed

Hi

I apologize for the very late reply.

The starter content preg_match that you mention was updated 6 months ago, so I will close this as resolved.
You may find this helpful: #45484

If this did not solve the problem, you are welcome to post your question again in the support forums.

Last edited 4 months ago by SergeyBiryukov (previous) (diff)

#3 @SergeyBiryukov
4 months ago

  • Component changed from General to Themes
  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.