add_filter("query_vars", function($vars) {
array_push($vars, "handler");
return $vars;
});
add_filter("rewrite_rules_array", function($rules) {
$newrules['custom/([0-9a-z-]{1,128})'] = 'index.php?pagename=custom&handler=$matches[1]';
return $newrules + $rules;
});
add_action("wp_loaded", function() {
global $wp_rewrite;
$wp_rewrite->flush_rules();
});