• Resolved Misty Reese

    (@mistyreese5)


    I am getting an error, let me explain about it below:

    Showing on WordPress Dashboard = Warning: Undefined array key “hide_admin_notices_for_nonadmins” in /home/gpt.khalsahosting.com/public_html/wp-content/plugins/admin-site-enhancements/settings.php on line 706

    Debug Log in hosting = [12-Jan-2024 07:55:02 UTC] PHP Warning: Undefined array key “hide_admin_notices_for_nonadmins” in /home/gpt.khalsahosting.com/public_html/wp-content/plugins/admin-site-enhancements/settings.php on line 706

    I wanted to inform the admin of this plugin so that he can fix it in the next update. Let me show you how to fix it:

    To solve the “Undefined array key” error in the “admin-site-enhancements” plugin, you need to make sure that the array key “hide_admin_notices_for_nonadmins” is defined before accessing it. Here’s the updated code for the “settings.php” file:

    <?php
    // Your existing code…

    // Check if the key is defined before accessing it
    if ( isset( $your_array[‘hide_admin_notices_for_nonadmins’] ) ) {
    $value = $your_array[‘hide_admin_notices_for_nonadmins’];

    // Rest of your code...

    } else {
    // Handle the case when the key is not defined
    $value = false; // Set a default value or handle the error in any way you prefer
    }

    // Your existing code…

    In this code snippet, we first check if the array key “hide_admin_notices_for_nonadmins” is defined using the isset() function. If it is defined, we assign its value to the $value variable. Otherwise, we handle the case when the key is not defined by setting a default value or handling the error in any way you prefer.

    Make sure to replace $your_array with the actual array variable that contains the “hide_admin_notices_for_nonadmins” key in your code.

    By adding this check, you can avoid the “Undefined array key” error and ensure that your code runs without any issues.

    The page I need help with: [log in to see the link]

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

    (@qriouslad)

    Thank you. I’ve fixed this PHP warning in three places in the previous release but missed the last one. So, this will be fixed in the next release. Probably early next week if not sooner.

    Plugin Author Bowo

    (@qriouslad)

    This has been resolved in a previoius release. Marking this thread resolved now.

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

The topic ‘Warning: Undefined array key “hide_admin_notices_for_nonadmins” in’ is closed to new replies.