php - WordPress remove_filter() to remove theme JS hook via plugin -
i have theme adding custom, full-screen background image via jquery. theme doing via class
object called td_background
. within class function called wp_head_hook()
, , within hook, filter beingness added custom bg. looks this:
class td_background { // ..some stuff function __construct() { add_action('wp_head', array($this, 'wp_head_hook'), 10); } function wp_head_hook() { add_filter( 'td_js_buffer_footer_render', array($this, 'add_js_hook')); } function add_js_hook($js) { // custom js added here background image homecoming $js } } new td_background();
i'm trying de-register add_js_hook
in custom plugin i'm writing, having problem wrapping mind around how nesting. i've tried few things, such as:
<?php // this... remove_filter( 'wp_footer', array($td_background, 'td_js_buffer_footer_render')); // ...and remove_filter( 'wp_footer', 'td_js_buffer_footer_render'); // ...and remove_filter( 'wp_footer', 'add_js_hook', 100); ?>
i've tried changing above wp_head
.
thoughts? end goal de-register javascript in footer, can add together own in place of it.
as it's beingness instantiated anonymously, have utilize handy function remove_anonymous_object_filter()
wpse, like:
// run plugin add_action( 'template_redirect', 'kill_anonymous_example', 0 ); function kill_anonymous_example() { remove_anonymous_object_filter( 'wp_head', 'td_background', 'wp_head_hook' ); }
i tested killing wp_head
don't have td_js_buffer_footer_render
running.
php wordpress oop
No comments:
Post a Comment