#39149 closed defect (bug) (worksforme)
starter-content options limited to some names?
| Reported by: | Looimaster | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Themes | Version: | 4.7 |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: |
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', ) ), ), ) );
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
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.