WordPress Advanced Hook Sniffer
[resolved] PHP Error on activation (11 posts)

  1. NateWr
    Posted 2 years ago #

    When I try to activate this plugin, it makes a require_once() call to load wp-hook-sniff-core.php. This fails because the plugin's folder name is (mis)defined.

    The error occurs on line 71 of wp-hook-sniffer.php. Here's the relevant code:

    /* Define the component's parent folder name */
    	define( 'WP_HOOK_PLUGIN_NAME', 'wordpress-hook-sniffer' );
    	/* Define the component's loader file -- this file */
    	define( 'WP_HOOK_PLUGIN_LOADER', 'wp-hook-sniffer.php' );
    	/* Define component's directory and URL Paths */
    	/* WordPress is installed and activated, finish initialization and go! */
    	require_once( WP_HOOK_PLUGIN_DIR . '/wp-hook-sniff-core.php' );

    Notice that the WP_HOOK_PLUGIN_NAME is 'wordpress-hook-sniffer' but the plugin installs to 'hook-sniffer' when installed through the WP admin dashboard. Since people can rename the plugin directory, I find the following a more reliable way to define the plugin path info:

    define( 'PLUGIN_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
    define( 'PLUGIN_URL', untrailingslashit( plugins_url( basename( plugin_dir_path( __FILE__ ) ), basename( __FILE__ ) ) ) );
    define( 'PLUGIN_FNAME', plugin_basename( __FILE__ ) );


  2. NateWr
    Posted 2 years ago #

    FYI, in case anyone else runs into the same issue. This also means that I can't deactivate the plugin through the interface, so it has not restored the default /wp-includes/plugin.php file. I needed to manually restore this file to prevent a PHP notice from displaying on the permalinks page.

  3. Mirco Babini
    Plugin Author

    Posted 2 years ago #

    Thank you so much for your feedback.

    I'll fix that asap today.

    Thanks again.

  4. matifibrahim
    Posted 2 years ago #


    Please check the plugin on wp3.9 it is throwing error on activation.

  5. Mirco Babini
    Plugin Author

    Posted 2 years ago #

    Check the latest 0.17 release.

    @NateWr thank you so much for your feedback.
    @matifibrahim hope it works for you now.

    If you find the plugin useful, feel free to review it with some stars :)

    Thanks again,

  6. matifibrahim
    Posted 2 years ago #


    Throwing fatal error when go to Settings->WP Hook Sniffer

    Fatal error: Call to undefined function wp_register_plugin_realpath() in C:\wamp\www\wp3.9\wp-settings.php on line 213

    same error when you try to deactivate the plugin. A through testing is needed on wp3.9 if you want to resurrect this plugin. Thanks for your efforts.

  7. Mirco Babini
    Plugin Author

    Posted 2 years ago #

    It's coz your WordPress is corrupted.
    As @NateWr said you must replace the /wp-includes/plugin.php file.

    I'm sorry, it's here.


  8. cwgservices
    Posted 2 years ago #

    Hey Mirco, I have a modified plugin.php file that has the missing functions restored. I can provide by email, please contact me by replying to the [accidentally sent prematurely] email to you via contact form on your site.

    I put my new file in place of your 'modified' version, and I was able to activate the plugin on 3.9.1 without getting a fatal error. Unfortunately I didn't get any output either, even after checking all possible types of output in the settings page. So there's something else wrong but at least this avoids manual replacement of plugin.php to restore normal site operation.

    Thanks for your work on this. I hope you will contact me for the file, and that it will help. There are two sections where functions had to be added, and I commented the beginning and end of each section with my initials so you can easily zero in on the changes.

  9. Mirco Babini
    Plugin Author

    Posted 2 years ago #

    Latest 0.18 version fixes the issue, accordingly to this closed issue.

    Cheers (please leave a review),

  10. FryVisuals
    Posted 2 years ago #

    I downloaded this today and it corrupted my plugins file so I reverted back to the old one. Not sure if it's the same issue as above or a new one with the latest version.

    Using 3.9.2

  11. Mirco Babini
    Plugin Author

    Posted 2 years ago #

    Really sorry but I can't reproduce the issue.

    I just installed a fresh latest version of WordPress (3.9.2), installed the plugin from the store, activated it, used it, deactivated it and that's it. It works good.

    Can you try to provide more info?

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WordPress Advanced Hook Sniffer
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.