I am using Popup Maker plugin for WordPress and I am trying to prevent it to load on a particular page using the functions.php file of a child theme.
I’ve located in the plugin’s directory the file popup-maker.php which contains the following line at the end:
add_action( 'plugins_loaded', 'popmake_initialize', 0 );
If I remove / comment this line, the popup will not fire, so I guess this is the action I need to remove. I have read the WP codex and numerous posts but still can’t get it to work.
Right now I am stuck at this (function I have added in my child theme’s functions.php file):
function remove_popmaker() {
remove_action('plugins_loaded', 'popmake_initialize', 0);
}
add_action( 'init', 'remove_popmaker', 1 );
PS: I am using shopkeeper theme and Woocommerce.
All help appreciated, thanks.
you are adding a action to
init
which is afterplugins_loaded
so you cannot remove a action after it has run.you can try the same action but you will have to do this from a plugin
But i suspect actions added before yours will be run after, this may be unpredictable if not you may have to code a MUplugin (google this).
There is a way I managed to do this:
@BMM – Without knowing the use case as to why you need to disable the entire plugin on one page its hard to give you the best answer.
For example if you simply wanted a single popup to not show on one page you can use the conditions panel to add a negative condition using the (!) button. Click it to turn it red and you will check for the opposite of a condition, so
(!) Page Selected: Page xyz
would prevent it from loading on that page.Alternatively you can create your own custom conditions allowing you to add that condition to any popup.
Lastly if you wanted to unhook it just from the front end you can simply remove the rendering & script handlers
And if you want to prevent the queries as well
Hope that helps.