Support » Plugin: NinjaFirewall (WP Edition) - Advanced Security » Question about NinjaFirewall 3.8.x and editing theme PHP files

  • tomdkat


    Hi! A year ago, I started this thread:

    I wanted to find out if there’s anything that can be done, with recent versions of NinjaFirewall or WordPress 5.0.x to better deal with the problem of not being able to edit theme PHP files using the WordPress theme editor. Or is this something that will persist, until WordPress core changes how it handles editing theme PHP files?


Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author nintechnet



    Unfortunately, the bug ticket has never been answered :

    So I think I’ll have to try to solve the problem myself.
    Try this:
    1. Download the NinjaFirewall /lib/utils.php script.
    2. Right below the if (! defined( 'NFW_ENGINE_VERSION' ) ) { die( 'Forbidden' ); } line, enter this code:

    // ---------------------------------------------------------------------
    // Fix bug introduced in WordPress 4.9.2 (
    add_filter( 'pre_http_request', 'nf_pre_http_request', 10, 3 );
    function nf_pre_http_request( $preempt, $r, $url ) {
       if ( strpos( $url, '/wp-admin/plugin-editor.php' ) !== false ) {
       return false;
    // ---------------------------------------------------------------------

    This will catch the call to wp_remote_get and if the requested URL is /wp-admin/plugin-editor.php, it will close the current session.

    Thanks! I’ll give this a try.


Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.