Can’t switch theme after activation

It seems that you are executing updateTheme() in every page load. To execute tasks only on activation you should hooke the updateTheme() function to the register_activation_hook action hook: register_activation_hook( __FILE__, ‘activation_callback’ ); function activation_callback() { //The code inside this function is executed only on plugin activation $theme=”twentyeleven”; //SET the value of $theme to whatever you … Read more

variable created in page.php is null inside of header.php

Generally said, there should nothing be happening before the get_header() call. So initiate your class if is_page() is true via wp_head action hook. Example: add_action( ‘wp_head’, ‘initiate_my_class’ ); function initiate_my_class() { if ( is_page() ) { //code } } Edit: As @AndrewBartel in his comment said you can globalize your variable or implement some kind … Read more

Refresh or redirect page after activate my plugin

You should be able to do something like this: register_activation_hook(__FILE__, ‘my_plugin_activate’); add_action(‘admin_init’, ‘my_plugin_redirect’); function my_plugin_activate() { add_option(‘my_plugin_do_activation_redirect’, true); } function my_plugin_redirect() { if (get_option(‘my_plugin_do_activation_redirect’, false)) { delete_option(‘my_plugin_do_activation_redirect’); wp_redirect(MY_PLUGIN_SETTINGS_URL); } }

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