I want to create the a link like https://mywordpresssite.com/mypage, that should call my function and execute the code. I am doing this for my backend script call that link and send some parameters to save data in database, I want to create that link by plugin only so it will use any of other wordpress websites
I tried this by searching-
add_action( 'wp_loaded', function() {
if ( $_SERVER[REQUEST_URI] == '/mypage' ) {
data_collection();
}
});
function data_collection(){
//my coding stuff
}
But this showing me error and not worked as expected.