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

Custom plugin settings: clicking “save changes” does not display success message

I had the same issue as you did, but I found how to fix it in this tutorial: https://digwp.com/2016/05/wordpress-admin-notices/ Basically, I had my settings page outside of the Settings menu, so I had to explicitly add settings_errors() to my options page and they started working. 🙂 Hope that helps.

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

How to make WordPress use new Upload Path settings in Multisite Setup

In a multisite setup, you need to adjust the upload_path for each individual site through the Network Admin menu. Go to /wp-admin/network/sites.php. Edit the site in question. On the settings tab, you can find the Upload Path setting and change it to whatever you want. You can also adjust the URLs on this page. Look … Read more