How to organize the testing of arbitrary code at an arbitrary address?

Want to transition to some address (for example: site.EN?my_test=hello_world) connect some page with custom code. As I understand, you need to register the plugin and in it to register the action.
I can not figure out in the wilds of the routing Wordress'a, plz tell me.
April 3rd 20 at 18:49
1 answer
April 3rd 20 at 18:51
Solution
You may not need to deal with routing.
View in the direction of the hook template_redirect

Example
pan_template_redirect function() {
 if ($_GET['my_test']=='hello_world') {
...
exit();
}
}
But perhaps it is wise to use the hook request https://wp-kama.ru/hook/request
for template_redirect framed condition, which theoretically may not always work.

if ( wp_using_themes() ) {
/**
* Fires before determining which template to load.
*
* @since 1.5.0
*/
do_action( 'template_redirect' );
} - Lon.Leffler commented on April 3rd 20 at 18:54

Find more questions by tags WordPress