Title: Plugin throwing a fatal error on WP_DEBUG
Last modified: February 1, 2021

---

# Plugin throwing a fatal error on WP_DEBUG

 *  Resolved [brasofilo](https://wordpress.org/support/users/brasofilo/)
 * (@brasofilo)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/plugin-throwing-a-fatal-error-on-wp_debug/)
 * Hi, this is the error:
 * > [01-Feb-2021 19:12:01 UTC] PHP Fatal error: Uncaught Error: Using $this when
   > not in object context in /Users/usernameSites/website/htdocs/wp-content/plugins/
   > upload-media-by-url/inc/umbumedia.php:97
 * It’s a static method and should be **`self::umbu_mediaButtonScript()`** instead
   of _`$this->umbu\_mediaButtonScript()`_
    -  This topic was modified 5 years, 4 months ago by [brasofilo](https://wordpress.org/support/users/brasofilo/).
    -  This topic was modified 5 years, 4 months ago by [brasofilo](https://wordpress.org/support/users/brasofilo/).

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

 *  Thread Starter [brasofilo](https://wordpress.org/support/users/brasofilo/)
 * (@brasofilo)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/plugin-throwing-a-fatal-error-on-wp_debug/#post-13988222)
 * Another thing that needs fixing is your `enqueue_scripts`, it needs to check 
   for `$pagenow == 'upload.php'`.
    Right now, it’s being encoded all over the admin
   and could affect something unrelated. And you put 2 actions to enqueue when only
   1 is needed, change ‘wp_enqueue_scripts’ and ‘admin_init’ for ‘admin_enqueue_scripts’
 * Also, please review the function `umbu_media()`, this line doesn’t have brackets(
   it’s not clear if it should affect only the next command or all of them):
 * `if ( $pagenow == 'upload.php' )`
 * Maybe you mean `if ( $pagenow != 'upload.php' ) return;` ?
 * Finally, I just found another error, the action **`post-plupload-upload-ui`**
   is leaking on a WooCommerce page (edit.php?post_type=shop_order, maybe others),
   not sure how to solve it though… I tried to move it inside `load-upload.php` 
   but it didn’t work.
    -  This reply was modified 5 years, 4 months ago by [brasofilo](https://wordpress.org/support/users/brasofilo/).
    -  This reply was modified 5 years, 4 months ago by [brasofilo](https://wordpress.org/support/users/brasofilo/).
 *  Plugin Author [notetoservices](https://wordpress.org/support/users/notetoservices/)
 * (@notetoservices)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/plugin-throwing-a-fatal-error-on-wp_debug/#post-13990127)
 * You have found an error that was eluding me for some time with WooCommerce… and
   I will update your findings accordingly and package up with the next update, 
   thank you!

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

The topic ‘Plugin throwing a fatal error on WP_DEBUG’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/upload-media-by-url.svg)
 * [Upload Media By URL](https://wordpress.org/plugins/upload-media-by-url/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/upload-media-by-url/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/upload-media-by-url/)
 * [Active Topics](https://wordpress.org/support/plugin/upload-media-by-url/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/upload-media-by-url/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/upload-media-by-url/reviews/)

## Tags

 * [class](https://wordpress.org/support/topic-tag/class/)
 * [method](https://wordpress.org/support/topic-tag/method/)

 * 2 replies
 * 2 participants
 * Last reply from: [notetoservices](https://wordpress.org/support/users/notetoservices/)
 * Last activity: [5 years, 4 months ago](https://wordpress.org/support/topic/plugin-throwing-a-fatal-error-on-wp_debug/#post-13990127)
 * Status: resolved