As @toscho says you need an endpoint.
Note code is untested.
/**
* Flush rewrite rules
*/
function install_my_plugin() {
my_plugin_endpoint();
flush_rewrite_rules();
}
register_activation_hook( __FILE__, 'install_my_plugin' );
/**
* Flush rewrite rules
*/
function unistall_my_plugin() {
flush_rewrite_rules();
}
register_deactivation_hook( __FILE__, 'unistall_my_plugin' );
/**
* Add the endpoint
*/
function my_plugin_endpoint() {
add_rewrite_endpoint( 'action', EP_ROOT );
}
add_action( 'init', 'my_plugin_endpoint' );
function my_plugin_proxy_function( $query ) {
if ( $query->is_main_query() ) {
// this is for security!
$allowed_actions = array('123', '124', '125');
$action = $query->get('action');
if ( in_array($action, $allowed_actions) ) {
switch ( $action ) {
case '123' :
return call_user_func('function_123');
case '124' :
return call_user_func('function_124');
case '125' :
return call_user_func('function_125');
}
}
}
}
add_action( 'pre_get_posts', 'my_plugin_proxy_function' );