WordPress.org

Ready to get started?Download WordPress

Forums

register_activation_hook not working. I have a headache :( (1 post)

  1. Thorned Rose
    Member
    Posted 3 years ago #

    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.)

Topic Closed

This topic has been closed to new replies.

About this Topic