• RL

    (@yofazza)


    Hello,

    I have this warning on top of some Pages:

    Warning: Undefined array key -1 in [...] /wp-includes/post-template.php on line 330

    I’m generally a PHP programmer, not a WordPress expert, although I’ve worked with it occasionally for over a decade. Could I possibly get some pointers on where or what to look for?

    Checked the server log and I don’t see anything related, yet.

    WordPress and the plugins are all updated. The PHP version is 8.0. The theme is a potential suspect since it’s quite old, but I haven’t found any clear indicators that it’s the actual cause.

    Thank you.

Viewing 1 replies (of 1 total)
  • You can go to wp-config.php file and add this line of code at the end :

    define(‘WP_DEBUG’, true);
    define(‘WP_DEBUG_DISPLAY’, false);

    and then go to wp-content and there you will see a debug.log file open it and you will see all the error you have from which you can have an idea what is causing the issue.

    Additionally, you said that you suspect the theme to be the culprit which you can diagnose by going to wp-content and then opening the Themes folder and disabling the current one by renaming it folder like themename-disabled.

    This will automatically activate the other theme you have and then check if the error is gone or not.

    You can do the same troubleshooting with plugins also but instead of renaming single one of them for troubleshooting you can rename the plugin folder in wp-content and it will disable all the plugins and then check if the error is gone or not.

    If it’s gone you can then then activate the plugin one by one to check the culprit.

    • This reply was modified 1 year, 1 month ago by Bilal Afridi.
Viewing 1 replies (of 1 total)
  • The topic ‘Warning: Undefined array key -1 in […] /post-template.php on line 330’ is closed to new replies.