Notice: Use of undefined constant NONCE_ACTION_NAME
-
Hi,
I get this notice (with WP_DEBUG on) on plugin configuration page:
Notice: Use of undefined constant NONCE_ACTION_NAME - assumed 'NONCE_ACTION_NAME' in /opt/lampp/.../wp-content/plugins/favicon-by-realfavicongenerator/admin/class-favicon-by-realfavicongenerator-admin.php on line 130
On line
130
you are refering to const like this:
$nonce = wp_create_nonce( NONCE_ACTION_NAME );
within a class.
Using this:
$nonce = wp_create_nonce( self::NONCE_ACTION_NAME );
or this:
$nonce = wp_create_nonce( Favicon_By_RealFaviconGenerator_Admin::NONCE_ACTION_NAME );
fixes the problem.All this time you’ve been creating your nonce with ‘NONCE_ACTION_NAME’ string as action argument, because PHP assumed it’s a string ??
One more thing: in your PHP files you are using closing
?>
tags. This is not recommended practise, please see couple of top-rated answers on SO: https://stackoverflow.com/questions/4410704/why-would-one-omit-the-close-tag regarding this issue and this WordPress-specific article: https://hardcorewp.com/2013/always-omit-closing-php-tags-in-wordpress-plugins/.Thanks for the plugin, great work.
Cheers,
Danielhttps://www.ads-software.com/plugins/favicon-by-realfavicongenerator/
- The topic ‘Notice: Use of undefined constant NONCE_ACTION_NAME’ is closed to new replies.