• Resolved Adrian Stepan

    (@stepanadrianro)


    Hi

    While the plugin is activated the wp-admin/nav-menus.php returns the following error:

    ”There has been a critical error on your website. Please check your site admin email inbox for instructions.”

    and the email received is

    ”An error of type E_ERROR was caused in line 92 of the file /home/xxx/xxx.ro/wp-content/plugins/hd-quiz/includes/post-type.php. Error message: Cannot redeclare hdq_add_warning() (previously declared in /home/xxx/xxx.ro/wp-content/plugins/hd-quiz/includes/post-type.php:95)”

    Can you fix this?

    Thanks
    Adrian

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Harmonic Design

    (@harmonic_design)

    Hi stepanadrianro,
    this is an interesting one!

    The error means that your site already has a function called hdq_add_warning running, but the chances of that are insanely small. All HD Quiz functions are prefixed with hdq_ for this very reason – to reduce the chances that your site theme or any other additional plugins already use a function with the same name.

    Because of this, one of two things are happening. 1) another plugin you are using is also using the hdq_ prefix (which it shouldn’t – I’ve had it reserved for over 5 years), or 2) something is broken on your site and for whatever reason, the nav page specifically is loading HD Quiz twice (for example, if your site runs admin_enqueue_scripts twice.

    WHAT TO DO.

    The first thing to do is determine if the issue is another plugin, or if there is something else broken on your site. We can check by first deactivating ALL plugins except HD Quiz and see if the problem persists.

    If the problem is still there then we know at the very least that it is not another plugin interfering. If the problem goes away, then you can reactive each plugin again one by one until we figure out the one causing the issue. Let me know which it is and I can reach out to them to request they change the function name.

    We can also do the same with the theme by switching the theme to the default theme to see if that makes a difference.

    HOW TO FIX NOW
    Regardless if we determine that the issue is caused by another plugin or if the issue is some other breaking bug with your site, you can make the following edit to “fix” this issue now.

    Using the plugin editor, navigate to ./includes/post-type.php and delete the lines 90 (function called hdq_add_warning_to_quiz_tax) to 137. This will completely remove the function.

    The editor can be accessed by going to plugins -> plugin editor, then selecting HD Quiz from the top right dropdown.

    Lastly, as a super last resort if for whatever reasons you are not comfortable making any of the steps above, you can always temporarily deactivate HD Quiz before using the Menus page, then reactivate once done. Obviously not the best solution, but at least it’s easy!

    Thread Starter Adrian Stepan

    (@stepanadrianro)

    Thank you very much for the detailed solution. I used your last tip since that is the easiest one 🙂 I appreciate it!

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

The topic ‘Bug – wordpress menu error’ is closed to new replies.