Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove_filters_for_anonymous_class not removing action for extended class #1

Open
Jarrydcrawford opened this issue Feb 7, 2013 · 3 comments

Comments

@Jarrydcrawford
Copy link

The plug-in authors of Shopp have added in-line styles to <head> of the document. They attach it via the class Storefront which extends FlowController. Within the class you have two functions: behaviors (540) and catalogcss (739). See https://gist.github.com/Jarrydcrawford/3cd52271dab887e0bb7a

The function catalogcss sets the CSS, while behaviors sets it via

add_action('wp_print_styles',array($this, 'catalogcss'));

I tried using your seconds example like so

// Remove inline CSS from Shopp
remove_filters_for_anonymous_class( 'wp_print_styles', 'Storefront', 'catalogcss', 999 );

But it seems to do nothing. I'm assuming it has something to do with the extending, but I honestly have no idea.
Reckon you could take time out of your busy schedule to see if you can figure it out? :)

@herewithme
Copy link
Owner

Try with correct priority, by default WP set 10

// Remove inline CSS from Shopp
remove_filters_for_anonymous_class( 'wp_print_styles', 'Storefront', 'catalogcss', 10 );

@Jarrydcrawford
Copy link
Author

I tried with the new priority and still no effect. I only used 999 to make sure that the action was being registered before I was trying to remove it.

@herewithme
Copy link
Owner

This function must be call after plugin hook registration :
Here is the code below (untested) :

    add_action('wp', array($this, 'remove_storefront_catalogcss'), 11);
    function remove_storefront_catalogcss() {
        // Remove inline CSS from Shopp
        remove_filters_for_anonymous_class( 'wp_print_styles', 'Storefront', 'catalogcss', 10 );
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants