0

I am trying to build a wp plugin using vuejs and the bulma css framework, but it seems like it is having an impact on the whole admin area.

Is it possible to load my css only on my plugin admin page?

1

1 Answer 1

1

To answer the question, from the codex, listed above in the comments.

function load_custom_wp_admin_style($hook) {
        // Load only on ?page=mypluginname
        if($hook != 'toplevel_page_mypluginname') {
                return;
        }
        wp_enqueue_style( 'custom_wp_admin_css', plugins_url('admin-style.css', __FILE__) );
}
add_action( 'admin_enqueue_scripts', 'load_custom_wp_admin_style' );

Note: If you are unsure what your $hook name is .. use this to determine your hookname. Put the code after the { from the function.

wp_die($hook);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.