[wp-hackers] Remove wp_enqueue_style called mid-page

Dino Termini dino at duechiacchiere.it
Wed Mar 26 17:39:05 UTC 2014


Thank you Nikola and Andrew! It worked like a charm!

On 3/26/14, 12:03 PM, Nikola Nikolov wrote:
> Hi Dino,
>
> Have you tried simply enqueueing that style? In theory WP shouldn't render
> the same style/script twice.
>
> function my_enqueue_plugin_style() {
>      wp_enqueue_style( 'plugin-style' );
> }
> add_action( 'wp_enqueue_scripts', 'my_enqueue_plugin_style' );
>
> If the plugin doesn't register the style all the way until it's enqueued,
> then it'd be a bit more tricky, but something like this should work:
>
> function my_dequeue_plugin_style() {
>      wp_dequeue_style( 'plugin-style' );
> }
> add_action( 'wp_footer', 'my_dequeue_plugin_style' );
>
> function my_enqueue_plugin_style() {
>      wp_enqueue_style( 'plugin-style', $url_to_plugin_css_file );
> }
> add_action( 'wp_enqueue_scripts', 'my_enqueue_plugin_style' );
>
> Nikola
>


More information about the wp-hackers mailing list