EME ignores custom Content folders (WP_CONTENT_DIR, WP_CONTENT_URL)
-
While working on integrating EME into a site I’m working on, I checked my site’s rendered code to make sure everything was displaying properly. That’s when I noticed an error in the call to the EME stylesheet…
<link rel='stylesheet' id='eme_stylesheet-css' href='https://www.mysite.com/content/plugins/homepages/12/x123456789/htdocs/mysite.com/www/content/plugins/events-manager-extended/events_manager.css?ver=3847' type='text/css' media='all' />
As you can see in the path above, my WordPress content folder isn’t in the default location as I make use of
WP_CONTENT_DIR
andWP_CONTENT_URL
in mywp-config.php
file (for safety and security).Looking over the code, I noticed that EME doesn’t check for any use of these custom configs. To fix this up, I made the following changes in events-manager.php:
First, around Line 114, I added a few lines to define WP_CONTENT_DIR and WP_CONTENT_URL using the default WordPress content paths, in case they haven’t been defined:
if (!defined('WP_CONTENT_URL')) define('WP_CONTENT_URL', get_option( 'siteurl' ) . '/wp-content'); if (!defined('WP_CONTENT_DIR')) define('WP_CONTENT_DIR', ABSPATH . 'wp-content'); if (!defined('WP_PLUGIN_URL')) define('WP_PLUGIN_URL', WP_CONTENT_URL. '/plugins'); if (!defined('WP_PLUGIN_DIR')) define('WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins');
Next, I had to make a couple of edits to the
EME_PLUGIN_URL
andEME_PLUGIN_DIR
definitions, which are now around Line 121:define('EME_PLUGIN_URL', WP_PLUGIN_URL.'/events-manager-extended/'); //PLUGIN DIRECTORY define('EME_PLUGIN_DIR', WP_PLUGIN_DIR.'/events-manager-extended/'); //PLUGIN DIRECTORY
The plugin’s name (
events-manager-extended
) is hard-coded, which I normally don’t like, but I just wanted to get this issue fixed before worrying about adding more.If you’re having this issue, this is one way to fix it. There may be alternate ways, but figured I’d get this one out there.
- The topic ‘EME ignores custom Content folders (WP_CONTENT_DIR, WP_CONTENT_URL)’ is closed to new replies.