wordpressurleasy-digital-downloads

Rewrite rules for EDD product page


I want my url changes depending on the term of taxonomy category_download custom post types download.

Example:

I have 2 categories:

– plugins

– themes

I wish I had a url for my single download:

/plugins/name_of_download/

AND

/themes/name_of_download/


Solution

  • Try adding this code to your themes functions.php file,

    function __custom_messagetypes_link( $link, $term, $taxonomy )
     {
         if ( $taxonomy == 'plugins' ){
    
                return str_replace( 'plugins/', '', $link );
    
         }
         else if ( $taxonomy == 'themes' ){
    
                 return str_replace( 'themes/', '', $link );    
         }
         else{
    
                 return $link;
         }
    
     }
    add_filter( 'term_link', '__custom_messagetypes_link', 10, 3 );
    

    I am assuming the used slug, May be you have to change the your taxonomy slug if these are different.

    If have any problem you can freely ask, Thanks,