#4961 closed enhancement (no action required)
Overriding CSS in plugin doesn't seem to work
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Core | Keywords: | |
Cc: |
Description
I'm working on a plugin to replace the legacy css with it's own. My first plan for this was to remove_action on the following:
add_action( 'bp_enqueue_scripts', array( $this, 'enqueue_styles' ) ); // Enqueue theme CSS
I think having this ability would make sense.
In an attempt to get something working, I looked at wp_dequeue_style but that's not taking due probably to order I assume.
If there is a way and I'm missing that it's something I hope to add to the codex once know. If it's not working in the obvious way I think others could benefit from this documented. Personally, I think the obvious way would be to remove_action then add_action back.
Whilst, you can of course override using a theme having the similar ease in a plugin for just the CSS could be great.
Change History (4)
#2
@
12 years ago
- Resolution set to invalid
- Status changed from new to closed
I recommend using wp_dequeue_style()
, as you initially suggest. If it's "not taking" due to load order issues, then hook it later:
function bp4961_dequeue_style() { wp_dequeue_style( 'bp-legacy-css' ); } add_action( 'bp_enqueue_scripts', 'bp4961_dequeue_style', 20 ); // Loads after theme compat has enqueued
You can't use
$this
because PHP needs to know what it's referencing.BP has a hook a bit lower in that class method called
'bp_theme_compat_actions'
you can use which will allow you to reference that class.Try this: