I've plenty of custom taxonomies and terms during my custom wordpress theme and I wish to rewrite the guidelines using my rewrite functions that appears such as this

function my_flush_rules() {
    $rules = get_option('rewrite_rules');
    if (!isset($rules['my_taxonomy/my_term/(\d*)/?$'])) {
    global $wp_rewrite;
    $wp_rewrite->flush_rules();
    }
}

function my_rules($rules) {
    $newrules = array();
    $newrules['my_taxonomy/my_term/page/(\d*)/?$'] = 'my_taxonomy=my_term&page=$matches[1]';
    return $newrules + $rules;
}

however i get confused after i attempt to rewrite all my taxonomies and terms, I'm not sure how you can loop all of them. :(

I would like all of them to stay in a flexible or array i quickly can place it towards the wordpress functions therefore it will might be seem like this

function my_flush_rules() {
    $rules = get_option('rewrite_rules');
    if (!isset($rules['$taxonomy/$term/(\d*)/?$'])) {
    global $wp_rewrite;
    $wp_rewrite->flush_rules();
    }
}

Help me