Title: Plugin breaks when WP_PLUGIN_DIR and WP_PLUGIN_URL are set
Last modified: December 19, 2016

---

# Plugin breaks when WP_PLUGIN_DIR and WP_PLUGIN_URL are set

 *  Resolved [heiglandreas](https://wordpress.org/support/users/heiglandreas/)
 * (@heiglandreas)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/plugin-breaks-when-wp_plugin_dir-and-wp_plugin_url-are-set/)
 * Hi.
 * In a setup where WP_PLUGIN_URL and WP_PLUGIN_DIR are already set the plugin can
   not be activated due to a fatal error in line 39 of `googleanalytics.php`.
 * This is because of line 27 and 30 where – despite a previously defined WP_PLUGIN_URL/
   DIR – the path to the plugin is defined via `WP_CONTENT_URL/DIR . '/plugins/'.
   GA_NAME`.
 * Replace those two lines with the safe `WP_PLUGIN_URL/DIR . '/' . GA_NAME` and
   everything works like a charm!
 * Alternative would be to use `plugin_dir_path` resp. `plugin_dir_url`.
 * Cheers
 * Andreas

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Brandon (ShareThis Support)](https://wordpress.org/support/users/brandonsharethis/)
 * (@brandonsharethis)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/plugin-breaks-when-wp_plugin_dir-and-wp_plugin_url-are-set/#post-8569303)
 * Hi Andreas!
 * Thank you so much for providing some details on a fix for this issue.
    I’ve gone
   ahead and let our engineering team know and they will look into this first thing.
   If you have any other questions or feedback please feel free to let us know.
 * Thanks again Andreas!
 * Brandon
 *  [Brandon (ShareThis Support)](https://wordpress.org/support/users/brandonsharethis/)
 * (@brandonsharethis)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/plugin-breaks-when-wp_plugin_dir-and-wp_plugin_url-are-set/#post-8573609)
 * Hey [@heiglandreas](https://wordpress.org/support/users/heiglandreas/),
 * Thank you so much for providing feedback and a fix!
    Our engineering team found
   your work to be super helpful and have given you credit in the latest change 
   log. You can view the kudos here: [https://wordpress.org/plugins/googleanalytics/changelog/](https://wordpress.org/plugins/googleanalytics/changelog/)
 * Thanks again for the amazing feedback, we appreciate you!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Plugin breaks when WP_PLUGIN_DIR and WP_PLUGIN_URL are set’ is closed
to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/googleanalytics_b8e236.svg)
 * [ShareThis Dashboard for Google Analytics](https://wordpress.org/plugins/googleanalytics/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/googleanalytics/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/googleanalytics/)
 * [Active Topics](https://wordpress.org/support/plugin/googleanalytics/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/googleanalytics/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/googleanalytics/reviews/)

## Tags

 * [fatal error](https://wordpress.org/support/topic-tag/fatal-error/)

 * 2 replies
 * 2 participants
 * Last reply from: [Brandon (ShareThis Support)](https://wordpress.org/support/users/brandonsharethis/)
 * Last activity: [9 years, 4 months ago](https://wordpress.org/support/topic/plugin-breaks-when-wp_plugin_dir-and-wp_plugin_url-are-set/#post-8573609)
 * Status: resolved