Title: Plugin not working.
Last modified: August 6, 2020

---

# Plugin not working.

 *  Resolved [gsc89](https://wordpress.org/support/users/gsc89/)
 * (@gsc89)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/plugin-not-working-917/)
 * 2 issues.
 * Upon activating your plugin:
 * > [View post on imgur.com](https://imgur.com/a/Z4COQZn)
 * “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](https://stackoverflow.com/questions/6195451/how-to-get-wp-include-directory)
    -  This topic was modified 5 years, 9 months ago by [gsc89](https://wordpress.org/support/users/gsc89/).

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Thread Starter [gsc89](https://wordpress.org/support/users/gsc89/)
 * (@gsc89)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/plugin-not-working-917/#post-13216780)
 * This code would allow this plugin to work with bedrock installs. [https://roots.io/bedrock/](https://roots.io/bedrock/)
 *     ```
       $path = realpath(dirname(__FILE__) . '/../../../')."/wp-includes/pluggable.php";
   
       // This adds support for bedrock, ABSPATH is set by bedrock as part of the config.
       if(defined('ABSPATH')){
           $path = ABSPATH . '/wp-includes/pluggable.php';
       }
   
       $errors = false;
       // Check to see if required file exists. If not do not initialize plugin
       try {
           if( !file_exists( $path ) ) {
               throw new Exception ('Unable to load pluggable.php in: ' . $path . ' Safety Exit is disabled until this error is fixed.');
           }else{
               require_once($path);
           }
       }catch(Exception $e){
           if ( is_admin() ){
               ?>
               <div class="error notice">
                   <p><?= $e->getMessage(); ?></p>
               </div>
               <?php
           }
           $errors = true;
       }
       ```
   
 * You would probably need a better method to handle composer based installs not
   using bedrock.
 *  Plugin Author [Tomas Cordero](https://wordpress.org/support/users/tcordero/)
 * (@tcordero)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/plugin-not-working-917/#post-13319536)
 * Hey [@gsc89](https://wordpress.org/support/users/gsc89/),
 * Sorry for the late response! Works been crazy busy. Thats for the input! If you
   want you can make a pull request on the plugins [github](https://github.com/tomascordero/safety-exit)
   and I can review / merge it! However I will add it to my TODO list for the plugin!
 * Thanks,
    Tomas
 *  Thread Starter [gsc89](https://wordpress.org/support/users/gsc89/)
 * (@gsc89)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/plugin-not-working-917/#post-13355480)
 * Missed this sorry, I have done as you instructed and made a PR over on github.
 *  Thread Starter [gsc89](https://wordpress.org/support/users/gsc89/)
 * (@gsc89)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/plugin-not-working-917/#post-13744939)
 * [@tcordero](https://wordpress.org/support/users/tcordero/) can you please merge
   that pull request? Its been a few months now and would still like to use a non
   core modified version of your plugin.
 * [https://github.com/tomascordero/safety-exit/pulls](https://github.com/tomascordero/safety-exit/pulls)
 * Thanks,
    Sam.
 *  Plugin Author [Tomas Cordero](https://wordpress.org/support/users/tcordero/)
 * (@tcordero)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/plugin-not-working-917/#post-13746347)
 * Hey [@gsc89](https://wordpress.org/support/users/gsc89/)
 * Sorry about the delay! Started a new job a few months back and it has been go
   go go! I actually have been scheduling some time in the coming weeks to do a 
   massive overhaul of the button designer. Before I start on that I will merge 
   your addition into master. Keep an eye out for the update this weekend!
 * Thanks again for doing the pull request!
 * -Tomas
 *  Plugin Author [Tomas Cordero](https://wordpress.org/support/users/tcordero/)
 * (@tcordero)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/plugin-not-working-917/#post-13832188)
 * This update has been pushed!

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Plugin not working.’ is closed to new replies.

 * ![](https://ps.w.org/safety-exit/assets/icon.svg?rev=2837777)
 * [Safety Exit](https://wordpress.org/plugins/safety-exit/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/safety-exit/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/safety-exit/)
 * [Active Topics](https://wordpress.org/support/plugin/safety-exit/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/safety-exit/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/safety-exit/reviews/)

 * 6 replies
 * 2 participants
 * Last reply from: [Tomas Cordero](https://wordpress.org/support/users/tcordero/)
 * Last activity: [5 years, 5 months ago](https://wordpress.org/support/topic/plugin-not-working-917/#post-13832188)
 * Status: resolved