Editor role cannot save custom theme options

There’s a bug(ish) report regarding this here: http://make.wordpress.org/themes/2011/07/01/wordpress-3-2-fixing-the-edit_theme_optionsmanage_options-bug/ You can use a filter to modify the theme page capability. First you’ll want to edit your register_setting() calls to look like this: register_setting( ‘map-options’, ‘map_zoom’ ); register_setting( ‘map-options’, ‘map_longitude’ ); register_setting( ‘map-options’, ‘map_latitude’ ); The first parameter is the settings group and this is what we’re … Read more

Set a Default Value for an Option?

There isn’t anything clever that I can see. I’ve used two approaches in the past: 1 – Your plugin’s activation code could save all your default options, so that you never need to use the second parameter to get_option Really, this equates to your… default value for setting that have not yet been saved. 2 … Read more

Conditional Logic to Check for Site Icon

There exists a special function to check if the site icon is set, namely the has_site_icon() function. So you could try: add_action( ‘wp_head’, ‘wpse_default_site_icon’, 99 ); add_action( ‘login_head’, ‘wpse_default_site_icon’, 99 ); function wpse_default_site_icon() { if( ! has_site_icon() && ! is_customize_preview() ) { // your default icons here } } The case when the site icon … Read more

Hook/notify when any option or setting is added or updated

Looking at the sources (core files, wp-includes/option.php) you can always find your target hook tags: add_action(‘added_option’, ‘wpse230212_callback_add’, 10, 2); add_action(‘updated_option’, ‘wpse230212_callback_update’, 10, 3); function wpse230212_callback_add( $option_name, $option_value ) { // do stuff on add_option } function wpse230212_callback_update( $option_name, $old_value, $option_value ) { // do stuff on update_option } Hope that helps.

Multisite: setting theme and options when a new blog is created

The best hook I can find is wpmu_new_blog (line 1086, wp-includes/ms-functions.php, wpmu_create_blog()) – it passes 6 arguments like so; do_action( ‘wpmu_new_blog’, $blog_id, $user_id, $domain, $path, $site_id, $meta ); $meta is an array of initial site options, not to be confused with the options generated by populate_options(). Programatically creating nav menus may prove to be a … Read more

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