EDD_SLUG

This constant allows you to change the post type slug of the download post type. By default the slug is downloads, resulting in URLs that looks like this: http://yoursite.com/downloads/download-name, but by using this constant, you can define the slug as anything you want.

Place the following in your functions.php or any custom plugin to change the slug of the download post type:

define('EDD_SLUG', 'my-downloads-slug');

Note: after doing this, you should resave your permalink structure for the changes to fully take effect.

Comments

  1. Hi,

    I just tried to customize the URLs for my digital downlaods this way.
    The changing works well, though I noticed a bug coming with it:

    If you use the shortcode [purchase_link] in combination with the URL-change and one clicks on the titel of a download that appears due to the shortcode, the “Add to cart”-button is missing on the download-page you get relinked to.
    Plus, the preview image of the download (article-preview image) is not “locked”.
    In my case (I want to sell my photographs as digital downloads) this is a huge problem because if one clicks on the image, you are forwarded to the media-file in a resolution, that is already “worth” copying from the browser to use it without paying.

    I now chaged the URL-structure back to the original “…./downloads/…”.

    best regards and thanks for the awesome plugin anyways! ;-)

    Reply

  2. Robin F.

    Sure, I made the change again, here are the links:

    This is the original structure with ‘downloads’ (it actually still works, even though I changed the URL in the functions.php):
    http://fotografie.robinflume.de/downloads/new-york-city-cab-10/

    This the same download-file with customized URL:
    http://fotografie.robinflume.de/my-cutomized-downloads-slug/new-york-city-cab-10/

    Reply

  3. Robin F.

    That’s it, my bad! Thanks!

    Reply

  4. neeraga

    I did this and it changed the Slug on Single Downloads page perfectly
    For Eg: http://www.mysite.com/items/notifybar/

    However on the Category Page

    It’s still showing
    http://www.mysite.com/downloads/category/wordpress-plugins/

    How to alter the slug of the Category Page ?

    or is it possible to remove the downloads from the URL completely:
    Like this: http://www.mysite.com/category/wordpress-plugins/

    Reply

  5. neeraga

    Thanks, Thats great. I will wait for next week update.

    Reply

  6. Brad

    Thanks for this.

    Curious how I can include the slug followed by the categories in the permalinks. This is what I want ../my-downloads-slug/category/subcategory/title-of-download as of right now I have ../my-downloads-slug/title-of-download for my permalinks.

    Reply

  7. Sudar Muthu

    Is it possible to change the slug to include “/” so that instead of http://my-site.com/downloads/my-pro-addon it becomes http://my-site.com/my-free-plugin/pro-addons/my-pro-addon ?

    Reply

  8. Victor

    Hi, is there a way to remove the slug? may be some customization or another not easy way?

    Thanks

    Reply

  9. Maurizio Martinoli

    Hi
    it worked fine till last update.
    In functions.php i added

    // modded by maurizio
    define(‘EDD_SLUG’, ‘trip’);

    but after upgrading to latest version (1.9.4) it will not work anymore.

    I also went to settings and refreshed the permalinks but i still get the old slug.

    Can you help?
    thanks!

    Reply

  10. maurizio

    in wp-config.php there is no edd slug definition
    the only one i see is in functions.php of my theme folder

    Reply

  11. maurizio

    i found the problem! YAY!

    in the plugin called appthemer-crowdfunding there is a file called crowdfunding.php
    in there there is

    // EDD Slug above all.
    define( ‘EDD_SLUG’, apply_filters( ‘atcf_edd_slug’, ‘campaigns’ ) )

    so now it is solved!
    thanks!

    Reply

  12. MIke

    So I did what was stated above even read through the other comments and the URL still reads /downloads. I did go back and re-save my permalinks after updating the slug.

    Here is what I changed the Functions.php to:

    $slug = define( ‘EDD_SLUG’, ‘store’ ) ? EDD_SLUG : ‘store’;

    Did I do something wrong?

    Reply

  13. I had a different solution, in case anyone’s interested. To avoid re-defining the EDD_SLUG constant or adding code to the wp-config, which are some solutions I found online, I ended up creating a single file mu-plugin, which added a filter for ‘atcf_edd_slug.’

    Mu-plugins are always loaded before regular plugins, so you’ll be able to properly add the filter before it is applied in the Crowdfunding plugin.

    Here’s an example of the code I used for the mu-plugin:

    add_filter( ‘atcf_edd_slug’, ‘atcf_edd_slug__changeCrowdfundingSlug’ );

    function atcf_edd_slug__changeCrowdfundingSlug( $slug )
    {

    return ‘donations’;

    }/* atcf_edd_slug__changeCrowdfundingSlug() */

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>