add_filter( 'query_vars', 'add_query_vars' );
function add_query_vars( $vars ) {
$vars[] = 'my_param';
return $vars;
}
add_action( 'generate_rewrite_rules', 'add_my_rules' );
function add_my_rules() {
add_rewrite_rule( 'my_param/(\d+)?$', 'index.php?my_param=$matches[1]', 'top' );
}
add_action('wp', "test_cm");
function test_cm(){
$my_param_value = get_query_var('my_param');
echo $my_param_value;
}
function custom_rewrite_basic() {
add_rewrite_rule('^leaf/([0-9]+)/?', 'index.php?page_id=$matches[1]', 'top');
}
add_action('init', 'custom_rewrite_basic');