• I am trying to write my first plugin. I am going to write an plugin to add and execute some Javascript on non-admin pages.

    So I read some tutorials and figured I’d start with a simple plugin to make sure I understood everything I read. I just wanted to echo “Hello World” on the screen. Simple.

    I created the plugin and saw it in my admin. I activated it. So far, so good. Then… nothing happens. My code is extremely simple. I’m sure someone will look at it and see the problem.

    I did some more research online and I tried to echo the message several ways:

    <?php
    
    /*
    Plugin Name: Hello
    */
    
    function hello_world() {
     echo "Hello!";
      print("Hello World");
    }
    
    add_action('wp_print_scripts', 'hello_world');
    
    add_action('get_header', 'hello_world');
    
    add_action('get_footer', 'hello_world');
    
    add_action('wp_header', 'hello_world');
    
    add_action('wp_footer', 'hello_world');
    
    ?>

The topic ‘Help with my first simple "Hello World" Plugin’ is closed to new replies.