Plugin not working.
-
2 issues.
Upon activating your plugin:
“The plugin generated 186 characters of unexpected output during activation. If you notice “ headers already sent ” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.”
“Unable to load pluggable.php in: /wp-includes/pluggable.php Safety Exit is disabled until this error is fixed.”
Following up on this, I have looked into your plugin file.
This is not good code:
try { if( !file_exists(realpath(dirname(__FILE__) . '/../../../')."/wp-includes/pluggable.php") ) { throw new Exception ('Unable to load pluggable.php in: ' . realpath(dirname(__FILE__) . '/../../../')."/wp-includes/pluggable.php" . ' Safety Exit is disabled until this error is fixed.'); }else{ require_once(realpath(dirname(__FILE__) . '/../../../')."/wp-includes/pluggable.php"); } }catch(Exception $e){ if ( is_admin() ){ ?> <div class="error notice"> <p><?= $e->getMessage(); ?></p> </div> <?php } $errors = true; }
You are assuming all wordpress installs will have the pluggable.php file in the same location by relative path, this is poor.
Many wordpress installs are now based on composer meaning your relative path code here will not be accurate across all wordpress installs.
You should be working out where wordpress is actually installed not relying on this being correct by relative path.
This topic touches on the number of ways you can get this path without using relative paths like you have.
https://stackoverflow.com/questions/6195451/how-to-get-wp-include-directory
- The topic ‘Plugin not working.’ is closed to new replies.