How to use is_multisite() in a must-use-plugin?

MU-Plugins load very early– earlier that your theme or your normal plugins. Because of that, you sometimes need to hook functions that you would otherwise not have to hook. add_action( ‘plugins_loaded’, function () { if (( is_multisite() && !current_user_can(‘manage_network’) ) || ( !is_multisite() && !current_user_can(‘create_users’))) { add_action( ‘init’, create_function( ‘$a’, “remove_action( ‘init’, ‘wp_version_check’ );” ), … Read more

Hello dolly type plugin that allows people to add their own

Don’t use settings api for this. Register a custom post type, ‘Joke’ see register_post_type docs add_action( ‘init’, function () { $labels = array( ‘name’ => ‘Jokes’, ‘singular_name’ => ‘Joke’, ‘add_new’ => ‘Add New’, ‘add_new_item’ => ‘Add New Joke’, ‘new_item’ => ‘New Joke’, ‘edit_item’ => ‘Edit Joke’, ‘view_item’ => ‘View Joke’, ‘all_items’ => ‘All Jokea’, ‘search_items’ … Read more

Multiple entries in get_option results? or why is _multiwidget set to 1?

I found the answer. Multiwidget is a nice new feature within wordpress’ new widget API. Yet there is sparse documentation on how to use it. $options = get_option( ‘your_option_id’ ); if( isset($options) && isset($options[$this->number])) { //$this->number returns the unique widget id that corresponds to the database index $instance_options = $options[$this->number]; } //now use $instance_options[‘setting’]

Odd behaviour with submenu link creation

On the same page in codex you have this : NOTE: If you’re running into the “You do not have sufficient permissions to access this page.” message in a wp_die() screen, then you’ve hooked too early. So it answers to you question partly. The second part, the following code should work : add_action(‘admin_menu’, ‘my_add_submenu’); function … Read more

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