Call to undefined function add_action() in hello.php

PHP Fatal error: Call to undefined function add_action() in p-content/plugins/hello.php, I was getting the above error in the error logs. Assuming someone calling this URL directly. To avoid these I’ve added the WordPress good practice line on top of the script.

if ( !function_exists( 'add_action' ) ) {
echo 'Hi there! I\'m just a plugin, not much I can do when called directly.';
exit;
}
Editorial Staff
 

Editorial Staff at tutsplanet is a dedicated team to write various tutorial articles.