Last active
October 16, 2019 09:51
-
-
Save wpmudev-sls/a7e19de440675f8f9b4042bf4e2397cc to your computer and use it in GitHub Desktop.
Fix Database Cleanup is not working at all
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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