Constants – Easy Digital Downloads Documentation https://easydigitaldownloads.com Sell Digital Products With WordPress Mon, 30 Dec 2024 15:46:55 +0000 en-US hourly 1 https://wordpress.org/?v=6.8.2 https://easydigitaldownloads.com/wp-content/uploads/2023/10/cropped-new-favicon-1-32x32.png Constants – Easy Digital Downloads Documentation https://easydigitaldownloads.com 32 32 EDD_DISABLE_REWRITE https://easydigitaldownloads.com/docs/edd_disable_rewrite/ Mon, 24 Jan 2022 19:58:49 +0000 https://edd-site.lndo.site/docs/edd_disable_rewrite/ This constant allows you to disable the “pretty URLs” for the downloads post type. Some sites, particularly those notusing the downloads post type archive, may want to remove the rewrite structure of the custom post type entirely. This constant allows you to do that. To disable the rewrite, place this in your functions.php or any custom

The post EDD_DISABLE_REWRITE first appeared on Easy Digital Downloads.

]]>
This constant allows you to disable the “pretty URLs” for the downloads post type. Some sites, particularly those notusing the downloads post type archive, may want to remove the rewrite structure of the custom post type entirely. This constant allows you to do that.

To disable the rewrite, place this in your functions.php or any custom plugin:

define('EDD_DISABLE_REWRITE', true);

Note: you will want to resave your permalink structure after doing this.

The post EDD_DISABLE_REWRITE first appeared on Easy Digital Downloads.

]]>
EDD_READ_FILE_MODE https://easydigitaldownloads.com/docs/edd_read_file_mode/ Mon, 24 Jan 2022 19:58:45 +0000 https://edd-site.lndo.site/docs/edd_read_file_mode/ When downloads are delivered to the user, the files are read using the PHP readfile() function, but because some hosts do not allow files to be ready via URL, this will occasionally fail. The EDD_READ_FILE_MODE constant is available for these scenarios. Note, this is only valid for plugin versions before 1.1.5 If a host does

The post EDD_READ_FILE_MODE first appeared on Easy Digital Downloads.

]]>
When downloads are delivered to the user, the files are read using the PHP readfile() function, but because some hosts do not allow files to be ready via URL, this will occasionally fail. The EDD_READ_FILE_MODE constant is available for these scenarios.

Note, this is only valid for plugin versions before 1.1.5

If a host does not allow readfile() to access files via URL, then define this in functions.php or any custom plugin:

define('EDD_READ_FILE_MODE', 'header');

When this constant is defined to “header”, Easy Digital Downloads will use header(“location:” . $file_url) for directing the user to download the file. This is not as secure so should only be used when readfile() does not work.

The post EDD_READ_FILE_MODE first appeared on Easy Digital Downloads.

]]>
EDD_PLUGIN_DIR https://easydigitaldownloads.com/docs/edd_plugin_dir/ Mon, 24 Jan 2022 19:58:36 +0000 https://edd-site.lndo.site/docs/edd_plugin_dir/ This constant refers to the directory path of Easy Digital Download’s plugin folder. The path does not include a trailing slash.

The post EDD_PLUGIN_DIR first appeared on Easy Digital Downloads.

]]>
This constant refers to the directory path of Easy Digital Download’s plugin folder. The path does not include a trailing slash.

The post EDD_PLUGIN_DIR first appeared on Easy Digital Downloads.

]]>
EDD_PLUGIN_FILE https://easydigitaldownloads.com/docs/edd_plugin_file/ Mon, 24 Jan 2022 19:58:25 +0000 https://edd-site.lndo.site/docs/edd_plugin_file/ This constant refers to the file name of Easy Digital Download’s main plugin file: easy-digital-downloads.php

The post EDD_PLUGIN_FILE first appeared on Easy Digital Downloads.

]]>
This constant refers to the file name of Easy Digital Download’s main plugin file: easy-digital-downloads.php

The post EDD_PLUGIN_FILE first appeared on Easy Digital Downloads.

]]>
EDD_MENU_POSITION https://easydigitaldownloads.com/docs/edd_menu_position/ Mon, 24 Jan 2022 19:58:23 +0000 https://edd-site.lndo.site/docs/edd_menu_position/ This constant lets you change the menu position of the download post type in the WordPress dashboard menu. The default position is 15, but if you want to change it, place this in your functions.php or any custom plugin: define('EDD_MENU_POSITION', 25); 25 is the new position of the menu. Any valid number from this page can

The post EDD_MENU_POSITION first appeared on Easy Digital Downloads.

]]>
This constant lets you change the menu position of the download post type in the WordPress dashboard menu.

The default position is 15, but if you want to change it, place this in your functions.php or any custom plugin:

define('EDD_MENU_POSITION', 25);

25 is the new position of the menu. Any valid number from this page can be used.

Note: this constant has been removed from v1.0.8.5 and later. The issue does not exist past 1.0.8.4, so this constant is not needed.

The post EDD_MENU_POSITION first appeared on Easy Digital Downloads.

]]>
EDD_PLUGIN_URL https://easydigitaldownloads.com/docs/edd_plugin_url/ Mon, 24 Jan 2022 19:58:07 +0000 https://edd-site.lndo.site/docs/edd_plugin_url/ This constant contains the URL to the Easy Digital Downloads plugin folder. The URL will look something like this: http://yoursite.com/wp-content/plugins/easy-digital-downloads/.

The post EDD_PLUGIN_URL first appeared on Easy Digital Downloads.

]]>
This constant contains the URL to the Easy Digital Downloads plugin folder. The URL will look something like this: http://yoursite.com/wp-content/plugins/easy-digital-downloads/.

The post EDD_PLUGIN_URL first appeared on Easy Digital Downloads.

]]>
EDD_DISABLE_ARCHIVE https://easydigitaldownloads.com/docs/edd_disable_archive/ Mon, 24 Jan 2022 19:57:50 +0000 https://edd-site.lndo.site/docs/edd_disable_archive/ This is a constant used when registering the download post type. By defining this constant, and setting it to true you can disable the post type archive for downloads. This is useful for sites where downloads are displayed manually, via short codes or template tags, rather than via default post type archives. To disable the post type archives, place

The post EDD_DISABLE_ARCHIVE first appeared on Easy Digital Downloads.

]]>
This is a constant used when registering the download post type. By defining this constant, and setting it to true you can disable the post type archive for downloads. This is useful for sites where downloads are displayed manually, via short codes or template tags, rather than via default post type archives.

To disable the post type archives, place this in your theme’s functions.php, or any custom plugin:

define('EDD_DISABLE_ARCHIVE', true);
// disable download post type archive

The post EDD_DISABLE_ARCHIVE first appeared on Easy Digital Downloads.

]]>
EDD_USE_PHP_SESSIONS https://easydigitaldownloads.com/docs/edd_use_php_sessions/ Mon, 24 Jan 2022 19:57:15 +0000 https://edd-site.lndo.site/docs/edd_use_php_sessions/ Note: As of Easy Digital Downloads v3.3.0, there is a setting to disable PHP sessions (Database Sessions). See Session Handling here for details. By default, EDD chooses PHP sessions as they are typically more performance friendly than database driven session handling, and help avoid issues with some object caching plugins and their shortcomings with the

The post EDD_USE_PHP_SESSIONS first appeared on Easy Digital Downloads.

]]>
Note: As of Easy Digital Downloads v3.3.0, there is a setting to disable PHP sessions (Database Sessions). See Session Handling here for details.

By default, EDD chooses PHP sessions as they are typically more performance friendly than database driven session handling, and help avoid issues with some object caching plugins and their shortcomings with the transient option types.

In some cases, servers / hosting may not support PHP sessions, which can cause EDD to not function properly. If that’s the case, you’ll need to override the default by setting EDD PHP Sessions to false. All this does is tell EDD to use a different method to keep track of a user on the site.

Empty Cart

The checkout page reporting Empty Cart when an item should be added is a common symptom of PHP sessions not supported by the server. Please review Shopping Cart Is Empty at Checkout prior to disabling sessions as there are other reasons this could be happening.

If you need to change this default:

Place this constant in your wp-config.php file to disable EDD PHP Sessions:

define( 'EDD_USE_PHP_SESSIONS', false );

If you need to re-enable EDD PHP Sessions, either delete the line above or set it to

define( 'EDD_USE_PHP_SESSIONS', true );

If you are unsure of how to edit your wp-config.php file, please consult the official WordPress help page on editing the file.

Note: you must place this code above the line that says:

/* That's all, stop editing! Happy blogging. */

It is safe to leave the constant in wp-config.php indefinitely.

How do EDD PHP Sessions work?

If this constant is defined, Easy Digital Downloads will use PHP $_SESSION for storing cart data. By default, when the EDD_USE_PHP_SESSIONS constant is not defined, EDD will look to see if the server supports PHP based sessions and choose PHP session handling going forward. If the session_start function is not supported, then EDD falls back to the WP_Session class, which is a combination of browser cookies and database rows stored in the wp_options table.

The post EDD_USE_PHP_SESSIONS first appeared on Easy Digital Downloads.

]]>
EDD_SLUG https://easydigitaldownloads.com/docs/edd_slug/ Mon, 24 Jan 2022 19:57:03 +0000 https://edd-site.lndo.site/docs/edd_slug/ This constant allows you to change the post type slug (also referred to as permalink or URL suffix) 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 code snippet to

The post EDD_SLUG first appeared on Easy Digital Downloads.

]]>
This constant allows you to change the post type slug (also referred to as permalink or URL suffix) 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 code snippet to change the slug of the download post type:

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

The best way to apply the code snippet to your site is with a plugin that allows you to add custom code to your site. To do that, we recommend using WPCode. Click here to learn how to apply the snippet using WPCode.

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

The post EDD_SLUG first appeared on Easy Digital Downloads.

]]>