Fatal Error Call To Undefined Function Plugin_dir_path
tour help Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us WordPress Development Questions Tags Users Badges Unanswered Ask Question _ WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top PHP Fatal error when using plugin_basename up vote 0 down vote favorite I am in the process of writing my first plugin and my call to the plugin_basename(__FILE__) function results in a: PHP Fatal error: Call to undefined function plugin_basename() My plugin resides in a directory of its own under the standard wp-content/plugins/. I am also using wordpress 3.3.1 and have looked at the codex but cannot see anything wrong. The code block where it fails is shown below: Please update!'; if ( version_compare( $wp_version, SEND_INVITATION_REQUIRED_WP_VERSION, "<"
in my theme folder contained dozens of PHP Fatal error lines: ... [01-Jun-2011 14:25:15] PHP Fatal error: Call to undefined function get_header() in /home/accountname/public_html/ardamis.com/wp-content/themes/ars/index.php on line 7 [01-Jun-2011 20:58:23] PHP Fatal error: Call to undefined function get_header() in /home/accountname/public_html/ardamis.com/wp-content/themes/ars/index.php on line 7 ... The first seven lines of my theme's index.php file: I realized that the error was being generated each time that my theme's index.php file was called directly, and that the error was caused by http://wordpress.stackexchange.com/questions/44046/php-fatal-error-when-using-plugin-basename the theme's inability to locate the WordPress get_header function (which is completely normal). Thankfully, the descriptive error wasn't being output to the browser, but was only being logged to the error_log file, due to the inclusion of the ini_set(‘display_errors', 0); line. I had learned this the hard way a few months ago when I found that calling the theme's index.php file directly would generate https://ardamis.com/2011/06/02/fix-for-php-fatal-error-get_header-in-wordpress/ an error message, output to the browser, that would reveal my hosting account username as part of the absolute path to the file throwing the error. I decided the best way to handle this would be to check to see if the file could find the get_header function, and if it could not, simply redirect the visitor to the site's home page. The code I used to do this: So there you have it. No more fatal errors due to get_header when loading the WordPress theme's index.php file directly. And if something else in the file should throw an error, ini_set(‘display_errors', 0); means it still won't be sent to the browser. This entry was posted in Tutorials, Web Site Dev, WordPress and tagged 500 error, Apache, blogging, coding, php, programming, security, themes, troubleshooting, WordPress on 2 June 2011 by Oliver Baty. Post navigation ← Of
Sign in Pricing Blog Support https://github.com/GeekPress/wp-rocket-cli/issues/3 Search GitHub This repository Watch 3 Star 17 Fork 9 GeekPress/wp-rocket-cli Code Issues 3 Pull requests 0 Projects 0 Pulse http://www.potomachighlandsguild.com/wordpress/wp-content/plugins/jetpack/modules/error_log Graphs New issue Call to undefined function plugin_dir_path() #3 Closed ronilaukkarinen opened this Issue May 21, 2015 · 1 comment fatal error Projects None yet Labels None yet Milestone No milestone Assignees No one assigned 1 participant ronilaukkarinen commented May 21, 2015 When I run wp rocket