WordPress.org

Support

Support » Plugins and Hacks » Hacks » register_activation_hook not working. I have a headache :(

register_activation_hook not working. I have a headache :(

  • Basically all I want is a one off ‘admin_notices’ message when my plugin is activated. The code I am trying to use for it is thus:

    function message_on_activate(){
    	add_action( 'admin_notices', 'my_message' );
    		function my_message() {
    			echo '<div class="error"><p>Work stupid thing!</p></div>';
    		}
    }
    register_activation_hook( __FILE__, 'message_on_activate' );

    But, for the life of me, I cannot get this to work. I have tried a number of different things now and *nothing* has made any difference. All I can say is that I know registration_activation_hook is firing but it isn’t outputting the text (“Work stupid thing!”). Please for the love of the gods, someone help! Thanking you muchly in advance 🙂

    (MODS: I realised this was a better place for this topic so feel free to delete the other one in How To and Troubleshooting if you want.)

  • The topic ‘register_activation_hook not working. I have a headache :(’ is closed to new replies.
Skip to toolbar