#52821 closed defect (bug) (invalid)
TEMPLATEPATH needs to be removed from WordPress Core File
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | minor | Version: | 5.7 |
Component: | Themes | Keywords: | |
Focuses: | template | Cc: |
Description
Error Level: E_WARNING
Message: Use of undefined constant TEMPLATEPATH - assumed 'TEMPLATEPATH' (this will throw an Error in a future version of PHP)
File: /wp-includes/template.php
Line: 666
Referrer: unknown
Issuing a PHP warning, as this constant will disappear in a future version of PHP.
Please fix it.
Change History (3)
#1
@
4 years ago
- Milestone Awaiting Review deleted
- Resolution set to invalid
- Status changed from new to closed
#3
@
4 years ago
Use of undefined constant TEMPLATEPATH - assumed 'TEMPLATEPATH' (this will throw an Error in a future version of PHP)
...
Issuing a PHP warning, as this constant will disappear in a future version of PHP.
Just to clarify a bit, TEMPLATEPATH
is a WordPress constant, not a PHP one, so it does not depend on the PHP version. As noted above, the issue is likely caused by a plugin or theme using WordPress Theme API functions incorrectly.
The "will throw an Error in a future version of PHP" part refers not to this particular constant, but to the fact of using a constant before it's defined, which was deprecated in PHP 7.2:
Unquoted strings that are non-existent global constants are taken to be strings of themselves. This behaviour used to emit an
E_NOTICE
, but will now emit anE_WARNING
. In the next major version of PHP, an Error exception will be thrown instead.
This was implemented as part of Backward Incompatible Changes in PHP 8.0:
Attempting to access unqualified constants which are undefined. Previously, unqualified constant accesses resulted in a warning and were interpreted as strings.
Hi @dlinstedt,
Welcome to trac and thanks for the ticket! This isn't an issue in WordPress Core. This would occur if some code on your site is using Theme API functions before the
after_setup_theme
action.This trac is for managing issues related to WordPress Core. I'd recommend reaching out to the WordPress Support Forums for help with your site: https://wordpress.org/support/forums/