Only allow plugin to be activated on root site of multisite

You could check if the constant SITE_ID_CURRENT_SITE matches get_current_site()->id. The following does this for the activation. During runtime you have to check it again. register_activation_hook( __FILE__, ‘force_main_site_installation’ ); function force_main_site_installation() { if ( defined( ‘SITE_ID_CURRENT_SITE’ ) and SITE_ID_CURRENT_SITE !== get_current_site()->id ) { if ( function_exists(‘deactivate_plugins’) ) { deactivate_plugins( __FILE__ ); } die( ‘Install this plugin … Read more

When is it too late to call the action wp_enqueue_scripts?

The function wp_enqueue_scripts— with an ‘s’– is used as a callback to wp_head. All that the function wp_enqueue_scripts does is fire the wp_enqueue_scripts action. So the last time that you would be able to use the action wp_enqueue_scripts is before the wp_enqueue_scripts callback on the wp_head hook. In terms of theme templates, that means you … Read more

Plugin options table,is the data serialized

It totally depends on what data is being stored in the option, maybe_serialize will determine in the option is holding a singular static value, such as true/false, 0/1, empty string, whatever(it’s called when an option is created or updated).. it will serialize when dealing with objects and arrays, singular values are not serialized. The get_option … Read more

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