I've written a plugin and it has regular functions and a few class functions. At the end of the class function I have a line that runs the class like this:
$the_function = new the_function();
The plugin is only supposed to be running on one spesific page (not multiple pages) in wordpress admin zone, for example it is supposed to run only on:
The plugin seems to run on all pages and it happens to breaks the submit button on the wordpress customizer page. It stops customizer from saving data after pressing the customizer save button.
As a temporary fix I have added this around the line that runs the class function:
That works fine but it occurs to me that I imaging there is a more logical way to make a spesific function only run on a spesific wordpress admin page. To learn, I have read some other examples and I want more comments, please. What is your preferred method to make a single spesific function run on a spesific admin page?
I also tried to use
if(!is_customize_preview) but this is not spesific enough alone.