Access to option page by role/capability

You should be able to do this via the option_page_capability_{$option_page} hook – like: function wpse151616_grant_access_to_options_page_for editors() { return ‘edit_posts’; } add_filter( ‘option_page_capability_rooster’, ‘wpse151616_grant_access_to_options_page_for editors’ ); For possible return values take a look at Roles and Capabilities. The variable part – {$option_page} – of the hook name is substituted by the menu slug – $menu_slug – … Read more

Error when renaming option

I think you need to set a default value when you use get_option function plugin_setting_url() { $options = get_option(‘plugin_options’, array(’embedded_url’=>”)); echo “”; } Unless plugin_options already exists, then you would need to use wp_parse_args to merge two arrays. function plugin_setting_url() { $options = wp_parse_args(get_option(‘plugin_options’,array()),array(’embedded_url’=>”)); echo “”; }

Register a widget area when a theme option has been saved?

In functions.php write this code function my_optionally_widgets() { $option = get_options(‘wantwidget’); if($option == ‘yes’) { register_widget(‘mywidget’); /* add other widgets for registration here */ } } add_action(‘widgets_init’, ‘my_optionally_widgets’); function my_optionally_sidebars() { $option = get_options(‘wantsidebar’); if($option == ‘yes’) { register_sidebar($args); /* add other sidebars for registration here */ } } add_action(‘init’, ‘my_optionally_sidebars’); Remember that Widget Areas … Read more

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