I’m developing a WordPress plugin, and I want to do actions on every single page. However, it seems like my plugin will only work if I visiting a page that is using a part of it, for example, a shortcode. On every other pages, it doesn’t do anything. How can I tell WordPress to run my plugin’s hooks even if it’s not used on that specific page?

I tested it with this code. If I open a page that is using a shortcode registered by my plugin, “HUH?” will appear on the very top of the page.On every other pages, there’s nothing…

add_action('init', 'myplugin_init');
function myplugin_init() {
    echo 'HUH?';

Read more here: My plugin’s filters and actions don’t run everywhere


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: