Title: Fatal error: Cannot redeclare DNH function
Last modified: February 11, 2021

---

# Fatal error: Cannot redeclare DNH function

 *  Resolved [tezalsec](https://wordpress.org/support/users/tezalsec/)
 * (@tezalsec)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/fatal-error-cannot-redeclare-dnh-function/)
 * Hi, just tried your plugin for the first time, and immediately after the activation
   this error was shown. It seems your plugin and the wps-hide-login plugin both
   use the same function name “DNH” without putting them into classes.
 * Could you fix it? Until then deactivating..
 * Fatal error: Cannot redeclare DNH() (previously declared in ../wp-content/plugins/
   wps-hide-login/vendor/NicolasKulka/wp-dismissible-notices-handler/handler.php:
   629) in …/wp-content/plugins/advanced-responsive-video-embedder/php/Admin/vendor/
   julien731/wp-dismissible-notices-handler/includes/helper-functions.php on line
   34

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

 *  [tokyoprogressive](https://wordpress.org/support/users/tokyoprogressive/)
 * (@tokyoprogressive)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/fatal-error-cannot-redeclare-dnh-function/#post-14041779)
 * You need to go to
    [https://nextgenthemes.com/support](https://nextgenthemes.com/support)
   to ask a question. he asked not to use this forum.
 *  Thread Starter [tezalsec](https://wordpress.org/support/users/tezalsec/)
 * (@tezalsec)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/fatal-error-cannot-redeclare-dnh-function/#post-14044447)
 * [@tokyoprogressive](https://wordpress.org/support/users/tokyoprogressive/) , 
   thanks.
 * It seems the fault lies with the wps-hide-login plugin using an outdated library,
   other plugins are affected as well. The plugin developer is on it, I assume a
   solution is coming.
 *  Plugin Author [Nico](https://wordpress.org/support/users/nico23/)
 * (@nico23)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/fatal-error-cannot-redeclare-dnh-function/#post-14045448)
 * [@tokyoprogressive](https://wordpress.org/support/users/tokyoprogressive/) Thanks.
 * [@tezalsec](https://wordpress.org/support/users/tezalsec/) Correct. Hopefully
   not many other plugins use an outdated version, the check should have been in
   there from the beginning as it was intended to be used by multiple plugins/themes.
 *  Thread Starter [tezalsec](https://wordpress.org/support/users/tezalsec/)
 * (@tezalsec)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/fatal-error-cannot-redeclare-dnh-function/#post-14053672)
 * [@nico23](https://wordpress.org/support/users/nico23/) , the other plugin developer
   just updated his library, but the issue remains. I still have the fatal error.
 * Shouldnt you both just put the DNH() inside a class so it does not clash with
   other plugin’s use of the function?
 *  Thread Starter [tezalsec](https://wordpress.org/support/users/tezalsec/)
 * (@tezalsec)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/fatal-error-cannot-redeclare-dnh-function/#post-14056647)
 * [@nico23](https://wordpress.org/support/users/nico23/) , sorry to keep approaching
   you about this this way, hope you will pick it up.
 * The other developer points me to you. He has updated his library, but it seems
   it wasn’t about not being uptodate, just that the DNH function is declared twice.
 * It now looks like it is your plugin that loads the DNH function as: 1. outside
   of a class, and 2. without checking if it already exists.
 * The other developer says: “I have a function that checks if the function exists,
   if it already exists, I do not go to the rest of the file”.
 *  Thread Starter [tezalsec](https://wordpress.org/support/users/tezalsec/)
 * (@tezalsec)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/fatal-error-cannot-redeclare-dnh-function/#post-14057912)
 * [@nico23](https://wordpress.org/support/users/nico23/) , I checked both your 
   code in helper-functions.php, and my assumption is that you are both still at
   fault. It has nothing to do with libraries being uptodate.
 * The DNH function should be either in a class or have a unique function name, 
   like “ARVE_DNH”. The check for double occurrence of functions happens by php 
   itself before processing logic, so an if then statement at the start of the include
   file does not sufficiently solve this.
 * Please consider renaming the DNH function to a unique variant.
    -  This reply was modified 5 years, 3 months ago by [tezalsec](https://wordpress.org/support/users/tezalsec/).
 *  Plugin Author [Nico](https://wordpress.org/support/users/nico23/)
 * (@nico23)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/fatal-error-cannot-redeclare-dnh-function/#post-14058550)
 * > sorry to keep approaching you about this this way, hope you will pick it up.
 * OH really are you? Why you people keep ignoring the support site. What is so 
   hard to register and post there?
 * It’s not _my_ code you looked at but the code of the dev who wrote that library.
   But I guess this is what you meant.
 * Holy fuck I included that library because like 3 people had issue with admin 
   messages and I thought I included some code from someone else because WP in 2021
   stick lacks a basic API for something as basic as admin messages.
 * And turns out that lib fucking sucks.
 * > The DNH function should be either in a class or have a unique function name,
   > like “ARVE_DNH”. The check for double occurrence of functions happens by php
   > itself before processing logic, so an if then statement at the start of the
   > include file does not sufficiently solve this.
 * I think you are on the right track but you not really got it. Its just that the
   library needs to wrap ALL functions with
 * `if ( function_exists( 'EVERY_FUNCTION_IN_THAT_FILE' ) ) {`
 * There should be no need at all to rename anything. I do not know what you are
   talking about runtime … I know for a fact that wrapping functions with `if ( 
   function_exists` works and I it and have seen lot of uses of this.
 * I still a bit confused about why exactly, but I fixed it, tried this file with
   the wps-hide-login. After confirming the issue I applied this.
 * [https://github.com/julien731/WP-Dismissible-Notices-Handler/pull/14/files](https://github.com/julien731/WP-Dismissible-Notices-Handler/pull/14/files)
 * So not sure what you go on about renaming and putting it into a class, but THIS
   is how you do it.
 * [https://github.com/julien731/WP-Dismissible-Notices-Handler/blob/6907cc917b4c580515b8bd798d5294ccff5f37c4/includes/helper-functions.php](https://github.com/julien731/WP-Dismissible-Notices-Handler/blob/6907cc917b4c580515b8bd798d5294ccff5f37c4/includes/helper-functions.php)
 * The problem with this is every other plugin dev needs to update this flawed code.
   And the wps-hide-login dev actually uses a forked version of the library from
   another dev …
 * What a mess just by using one tiny lib … I will completely rename everything 
   in that lib I guess …
 * > both still at fault
 * Well, not really. I guess for using a “library” assuming it can actually be used
   as one but if you want to blame someone blame the person who wrote it. Mistakes
   happen, but it’s strange that this it not even fixed in the latest versions of
   this lib (even in different forks)
    -  This reply was modified 5 years, 3 months ago by [Nico](https://wordpress.org/support/users/nico23/).
 *  [NicolasKulka](https://wordpress.org/support/users/nicolaskulka/)
 * (@nicolaskulka)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/fatal-error-cannot-redeclare-dnh-function/#post-14058588)
 * Even while applying your solution on wps-hide-login in the vendors, I cannot 
   activate your plugin which makes a fatal error: /
 *  Plugin Author [Nico](https://wordpress.org/support/users/nico23/)
 * (@nico23)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/fatal-error-cannot-redeclare-dnh-function/#post-14058771)
 * You need to also apply it to ARVE in `libs` I tested it and it for sure works!
 * Will fix this soon with a renamed version of that class without the helpers altogether.
 *  Thread Starter [tezalsec](https://wordpress.org/support/users/tezalsec/)
 * (@tezalsec)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/fatal-error-cannot-redeclare-dnh-function/#post-14058809)
 * Hi [@nico23](https://wordpress.org/support/users/nico23/) ,
 * thanks for addressing it. And you are right, of course, by wrapping the whole
   function it should be solved. 🙂
 * FYI, I have never once used your plugin, I was about to try it, but never got
   beyond the fatal error. And I don’t like creating accounts on sites even before
   having tried the product even once.
 * I never meant any disrespect, I just meant to be helpful and keep the issue alive,
   as the subject didn’t seem to get any further because everyone was just pointing
   at each others plugins, and talking about updating libraries. And you are right
   of course, the fault is primary with the library maker.
 * Hope we are moving in the right direction with the library now. Cheers.
 *  Plugin Author [Nico](https://wordpress.org/support/users/nico23/)
 * (@nico23)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/fatal-error-cannot-redeclare-dnh-function/#post-14065317)
 *  Thread Starter [tezalsec](https://wordpress.org/support/users/tezalsec/)
 * (@tezalsec)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/fatal-error-cannot-redeclare-dnh-function/#post-14065356)
 * [https://static-15.sinclairstoryline.com/resources/media/db699e0c-2b6e-4a7c-8423-e69757a47aad-large16x9_aaa_album_art.jpg](https://static-15.sinclairstoryline.com/resources/media/db699e0c-2b6e-4a7c-8423-e69757a47aad-large16x9_aaa_album_art.jpg)

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

The topic ‘Fatal error: Cannot redeclare DNH function’ is closed to new replies.

 * ![](https://ps.w.org/advanced-responsive-video-embedder/assets/icon-128x128.png?
   rev=3338557)
 * [Advanced Responsive Video Embedder for Rumble, Odysee, YouTube, Vimeo, Kick ...](https://wordpress.org/plugins/advanced-responsive-video-embedder/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/advanced-responsive-video-embedder/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/advanced-responsive-video-embedder/)
 * [Active Topics](https://wordpress.org/support/plugin/advanced-responsive-video-embedder/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/advanced-responsive-video-embedder/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/advanced-responsive-video-embedder/reviews/)

 * 12 replies
 * 4 participants
 * Last reply from: [tezalsec](https://wordpress.org/support/users/tezalsec/)
 * Last activity: [5 years, 3 months ago](https://wordpress.org/support/topic/fatal-error-cannot-redeclare-dnh-function/#post-14065356)
 * Status: resolved