• Resolved rku4er

    (@rku4er)


    Quick intro:
    We use Thrive Leads plugin on our site which does load the content with AJAX on a page. But we noticed that backwpup stylesheet is going to the front-end with the Thrive responce.

    I found the function which will give you a vision of how it’s implemented and why there is an issue with BackWpup and Thrive Leads.

    From /wp-content/plugins/thrive-leads/inc/hooks.php:2367:

    
    <?php
    /**
     * this should output all the required javascript 
     * (external scripts and localization) that would 
     * normally go into the footer 
     */
      $wp_scripts = wp_scripts();
      foreach($wp_scripts->queue as $handle) {
        if ($handle === 'tve_frontend' && !empty($_POST['tcb_js'])) {
          @wp_deregister_script($handle);
          @wp_dequeue_script($handle);
        }
    
        if (strpos($handle, 'tve') === false && strpos($handle, 'tcb') === false && strpos($handle, 'tqb') === false) {
          @wp_deregister_script($handle);
          @wp_dequeue_script($handle);
        }
      }
    
      do_action('wp_print_footer_scripts');
      $response['body_end'] = ob_get_contents();
      ob_end_clean();
    }
    

    As you can see they use ob_get_contents() to get the buffer. But seems the backwpup.min.css goes to this buffer along with other front-end resources. But it shouldn’t happen on a front-end since it’s a back-end plugin.

    So I discovered that we have incorrect hook(admin_init) used for including CSS assets on the Backwpup admin page:

    /backwpup/inc/class-admin.php:36:

    
    add_action( 'admin_init', array( __CLASS__, 'admin_css' ) );
    

    /backwpup/inc/class-admin.php:68:

    
    /**
     * Admin init function
     */
    public static function admin_css() {
      //register js and css for BackWPup
      if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
        wp_enqueue_style( 'backwpup', BackWPup::get_plugin_data( 'URL' ) . '/assets/css/backwpup.css', array(), time(), 'screen' );
      } else {
        wp_enqueue_style( 'backwpup', BackWPup::get_plugin_data( 'URL' ) . '/assets/css/backwpup.min.css', array(), BackWPup::get_plugin_data( 'Version' ), 'screen' );
      }
    }
    

    Please read the codex https://codex.wordpress.org/Plugin_API/Action_Reference/admin_enqueue_scripts. It’s recommended to use this hook to load plugin stylesheets on admin pages.

    To resolve the issue we have to replace ‘admin_init’ filter hook with the ‘admin_enqueue_scripts’. I did this and tested on our staging server and problem has gone.

    Could you please include this fix in the next plugin release. Thanks!

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support BWU support

    (@duongcuong96)

    @rku4er
    Thank you for reporting this issue 🙂
    I am going to forward your report to our developers and this problem will be fixed in the next release!
    Btw, If you find BackWPUp is useful for you, we would really appreciate if you leave a positive review and rating.
    This would encourage us to develop new free features and provide free support 😀
    https://wordpress.org/support/plugin/backwpup/reviews/

    Thread Starter rku4er

    (@rku4er)

    @duongcuong96
    Thank you for a quick reply!
    Ok, sure. I will track the changelog.

    Thread Starter rku4er

    (@rku4er)

    Hey @duongcuong96,

    I just looked the Changelog and seems this change haven’t implemented in the last release(a week ago). Do you think it will come with the next release?

    Should be pretty small change. Or maybe you have any feedback from the developers?

    Thanks, Roman

    Plugin Support BWU support

    (@duongcuong96)

    @rku4er
    yes it’s on 3.5 branch, so the fix will come with the next release 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Plugin styles (backwpup.min.css) hooked with a wrong filter ‘admin_init”’ is closed to new replies.