• dimal

    (@dimalifragis)


    Hello.

    By debug log has daily Warnings:

    [15-Apr-2022 10:06:14 UTC] PHP Warning: Use of undefined constant STYLESHEETPATH – assumed ‘STYLESHEETPATH’ (this will throw an Error in a future version of PHP) in /home/wp-includes/template.php on line 703

    [15-Apr-2022 10:06:14 UTC] PHP Warning: Use of undefined constant TEMPLATEPATH – assumed ‘TEMPLATEPATH’ (this will throw an Error in a future version of PHP) in /home/wp-includes/template.php on line 706

    Not sure how to debug this, since it is pointing to wordpress files and not a plugin or theme.

    Any help is appreciated. I user WP 5.9.x and PHP 7.4.x and Kadence theme.

    Thank you

Viewing 9 replies - 1 through 9 (of 9 total)
  • Moderator threadi

    (@threadi)

    Deactivate all plugins and see if the error still occurs. If not, activate the plugins bit by bit until the message is visible again.

    Thread Starter dimal

    (@dimalifragis)

    Well this is not easy to do on a live site, we use around 40 plugins. It would take a month to finish. I tried to replicate the warning myself and failed. Not sure when and how it happens. I see around 10-15 warnings per day.

    Changing theme is also not possible as you understand.

    • This reply was modified 4 years, 1 month ago by dimal.
    Moderator threadi

    (@threadi)

    You could try the troubleshooting mode of this plugin from wordpress itself: https://ww.wp.xz.cn/plugins/health-check/ – with this you would only deactivate the plugins within your session and activate a theme to see if you still cause the error. You can then also reactivate the plugins individually.

    Alternatively, you could create a copy of the project and try it in the copy. Especially with larger projects, such a staging system is advisable anyway in order to be able to test technical changes before they go live.

    Dion

    (@diondesigns)

    Do you see this warning on every page load, or is it intermittent?

    If it’s on every page load, a recent WP update may not have fully completed and you may be missing one or more files. This can usually be fixed by using the re-install option from the updates page in the WP dashboard.

    If it’s intermittent, I suspect you are using a plugin with a (buggy) custom AJAX handler that is calling the WP locate_template() function but not loading the dependencies for the function. If so, you’ll need to do some detective work to determine which plugin is the culprit.

    Thread Starter dimal

    (@dimalifragis)

    @diondesigns I wished it happened on every load, that would be easy to find the cause.

    it happens during a day, around 10-15 times. Thank you for the tip, i will try to locate the issue.

    Dion

    (@diondesigns)

    If you are running Linux and have console/SSH access, you could go to the directory above wp-content (usually the WP root directory) and issue the following two commands:

    grep -rn wp-content -e "locate_template("
    grep -ndskip * -e "locate_template("

    The output of the first command will be a list of the themes/plugins that call the locate_template() function. The output of the second command will be a list of scripts in the WP root that call locate_template(). If neither command returns a result, then I wonder whether you are running some type of CRON task outside WordPress that is generating the warnings.

    If you are using Windows, then do a DuckDuckGo search on “grep windows” to find out how to install/run the grep program.

    Thread Starter dimal

    (@dimalifragis)

    Ok, did that.

    Plugins: GDPR Cookie Complience, GeoDirectory, TOP 10, wpForo and Kadence Theme

    also from your #2 suggestion within WordPress wp-includes, template.php and block-templates.php

    What i do next?

    MANY MANY thanks

    Thread Starter dimal

    (@dimalifragis)

    Also things i changes 2-3 days ago, was Kadence theme and 2 weeks back i added Geo directory.

    So, i guess those two are the suspects?

    Dion

    (@diondesigns)

    Yup, the Kadence theme and GeoDirectory plugin are the likely suspects. You might want to check the support areas for both to see whether your issue has been reported. And if not, perhaps you could submit a support question.

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

The topic ‘PHP Warning: Use of undefined constant STYLESHEETPATH, TEMPLATEPATH’ is closed to new replies.