Published on

Disabling the custom post type archive page in Easy Digital Downloads

Authors

By default, an Easy Digital Downloads powered website has a page that displays all the downloads for you. If you append /downloads to the end of your website URL you will see this page. This is called the custom post type archive page.

If you display your downloads on your website via the downloads shortcode, you may wish to disable this page entirely. I’ve noticed many people don’t even realise such a page exists on their website.

Simply add the following to your theme’s functions.php (or plugin):

if ( ! defined( 'EDD_DISABLE_ARCHIVE' ) ) {
define( 'EDD_DISABLE_ARCHIVE', true );
}

Finally, you should visit the Permalinks admin page at Settings Permalinks. By simply by visiting this page (you don’t need to save) it will flush WordPress’ rewrite rules.

If you don’t flush the rewrite rules, chances are you will still see the custom post type archive page, even after you have entered the code above and refreshed the browser.