Change the EDD Downloads URL Base
Replaces /downloads/ in your product URLs with a word you choose, such as /plugins/ or /templates/, without defining constants in wp-config.php.
Opens WPIDE on
Code
$wpide_edd_slug = 'plugins'; // New URL base.
add_filter( 'edd_download_post_type_args', function ( $args ) use ( $wpide_edd_slug ) {
$args['rewrite'] = array_merge( (array) ( $args['rewrite'] ?? array() ), array( 'slug' => sanitize_title( $wpide_edd_slug ), 'with_front' => false ) );
if ( ! empty( $args['has_archive'] ) ) {
$args['has_archive'] = sanitize_title( $wpide_edd_slug );
}
return $args;
} );
Notes
Visit Settings > Permalinks and click Save after activating, and set up redirects from the old URLs if the site is already live.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.