Skip to content

Instantly share code, notes, and snippets.

@wpmudev-sls
Last active October 16, 2019 09:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wpmudev-sls/a7e19de440675f8f9b4042bf4e2397cc to your computer and use it in GitHub Desktop.
Save wpmudev-sls/a7e19de440675f8f9b4042bf4e2397cc to your computer and use it in GitHub Desktop.
Fix Database Cleanup is not working at all
<?php
/**
* Plugin Name: [Hummingbird Pro] - Fix Database Cleanup is not working at all
* Description: [Hummingbird Pro] - Fix Database Cleanup is not working at all - 1144588839545212
* Author: Thobk @ WPMUDEV
* Author URI: https://premium.wpmudev.org
* License: GPLv2 or later
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
add_action( 'plugins_loaded', 'wpmudev_hmbp_fix_database_cleanup_not_working_func', 100 );
function wpmudev_hmbp_fix_database_cleanup_not_working_func() {
if( ! is_admin() ){
return;
}
if( defined('WPHB_VERSION') && class_exists( 'Hummingbird\WP_Hummingbird' ) ){
add_action( 'admin_enqueue_scripts', 'wpmudev_hmbp_fix_database_cleanup_not_working_assets', 99 );
function wpmudev_hmbp_fix_database_cleanup_not_working_assets( $hook_suffix ){
if( 'hummingbird-pro_page_wphb-advanced' !== $hook_suffix ){
return;
}
$custom_script = '
(function($){
$(function(){
$("#wphb-db-row-delete").off("click");
$("#wphb-box-advanced-db").on("click", "button", function(e){
e.preventDefault();
var _this = $(this);
WPHB_Admin.advanced.showModal( _this.data("entries"), _this.data("type") );
});
});
})(window.jQuery)
';
wp_add_inline_script( 'wphb-admin', $custom_script );
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment