Q:

How to change custom post type slug in wordpress

I install edd plugin and add products.  When I click on a product for single page or click any edd category the link generated http://site_url/downloads/category/recent-issues/ by plugin.  Now I want to change the slug of post type. 
Like

http://site_url/downloads/category/recent-issues/

To

http://site_url/issues/category/recent-issues/

I searched from google and found this code. 
function add_custom_rewrite_rule() {
    $current_rules = get_option('rewrite_rules');

    if( ($current_rules) ) {
        foreach($current_rules as $key => $val) {
            if(strpos($key, 'download') ! == false) {
                add_rewrite_rule(str_ireplace('download', 'issues', $key), $val, 'top');
            } // end if
        } // end foreach

    } // end if/else

    // ...and we flush the rules
    flush_rewrite_rules();

} // end add_custom_rewrite_rule
add_action('init', 'add_custom_rewrite_rule');

But this code not working. " Download" is the post type of edd products. 
So how can I change the slug of edd post type. 

A:

there is just a single line code to achieve what you want. 
define('EDD_SLUG', 'issues');

Remove your above code and paste this one in functions.php. 
For reference read this article.