I wrote a plugin which performs some notification tasks.This works fine.
Now, I want to execute the main plugin script when a HTTP request is adressed.
That's here I am a little confused :
My plugin source code is located in the classical WP plugin directory :
And here is the source of the main script that I want to be executed when an http request is adressed :
<?php require_once('../wp-load.php'); require_once(ABSPATH."wp-content/plugins/my-plugin/classes/Model.class.php") ; require_once(ABSPATH."wp-content/plugins/my-plugin/classes/MailNotifier.class.php") ; $mailNotif= new MailNotifier('email@example.com'); $mailNotif->sendMailToRecipient() ; ?>
Currently, this script is located in :
WordPressRoot/script/main.php this works, but I would like to remove it from the WP core files and only get files in my plugin directory.
I actually execute this script addressing the following http request:
How should I do this :
Shall I wrote a webservice in wordpress (I am not really familiar with this) ?
Shall I use a redirection rule in wordpress ?
What is the best way to do this proper ?
Thanks, greetings ben.