Support » Networking WordPress » do_action(‘wp-footer’, ‘function-name’) not working in plugin

  • Resolved jtrimm007

    (@jtrimm007)


    I am trying to develop a plugin for a project this upcoming semester. I need to echo results from the plugin directory to the frontend of the website. Usually, add_action and wp-footer work great in the child themes. Not so with plugins. Any help would be greatly appreciated. Thank you in advanced.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You can echo with wp_footer and plugins, here is an example: https://codex.wordpress.org/Plugin_API/Action_Reference/wp_footer
    The active theme has to use the wp_footer() function, and almost all do, so no problem.

    I have tried with no luck. Here is a basic example I have tried using.

    function test()
    {

    echo ‘something’;

    }

    add or do_action(‘wp_footer’, ‘test’);

    I have put this in several of my plugin files with no luck…. Thanks for replying @nnkikolov

    It is add_action, not do_action.
    Here is the example from the link I sent you. Copy it from here and try it:

    function your_function() {
        echo '<p>This is inserted at the bottom</p>';
    }
    add_action( 'wp_footer', 'your_function' );

    Then search the text in the source code of the page, even if it is not visible on the page it has to be in the source somewhere. If it is not, then the theme does not call the wp_footer() function or the plugin is not active.

    I double checked my syntax and it worked! I was trying to call all_admin_notices before wp_footer. Thank you for your help @nnikolov!

    • This reply was modified 2 weeks, 4 days ago by  jtrimm007.

    Cool, no problem 🙂

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.