Why does wp_customizer default values do not apply when theme is installed for the first time?

No, there is no automatic way to save all defaults, and for good reason. It avoids cluttering the database with unnecessary values, and allows themes to actually change their defaults down the line. Instead of trying to save all defaults, just change all your calls to get_theme_mod to include the default value as the 2nd … Read more

Customizer options limited to specific user roles?

There are 2 ways to do this. When registering a setting you can use the capability: $wp_customize->add_setting( ‘display_excerpt_or_full_post’, array( ‘capability’ => ‘edit_theme_options’, ‘default’ => ‘excerpt’, ‘sanitize_callback’ => function( $value ) { return ‘excerpt’ === $value || ‘full’ === $value ? $value : ‘excerpt’; }, ) ); When registering the control, you can use the render_callback … Read more

Customizer – binding jQuery created controls

Thanks Tom, Example: Just download the plugin WPSE 286375: A dynamic dropdown-pages control from here: Extract next two files in the wp plugin folder: (wp-contents/plugins) wpse-286375-controls.js and wpse-286375.php Activate WPSE 286375 plugin Go to wp dashboard/Customize/Homepage Settings there are 2 controls – Homepage and Posts Page with control’s IDs “page_on_front” and “page_for_posts” and third control … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)