Globally register styles but enqueue them selectively

I am trying to get my theme registered stylesheets in plugin, the purpose is I want to get all stylesheets in my plugin and then manipulate those registered styles.

stylesheets registered via

Read More
add_action('wp_enqueue_scripts', 'mytheme_register_styles', 1);

add_action('wp_enqueue_scripts', 'mytheme_enqueue_styles', 5);

and as you already know this action doesn’t get fired in backend, so I want a hookable / callable way so it gets enqueued and I can modify / manipulate for my needs and resave them.

Related posts

Leave a Reply

1 comment

  1. If you want the stylesheets registered in the backend, use the admin_enqueue_scripts action.

    function wp94156_register_styles() {
        wp_register_style(
            'your-stylesheet',
            get_stylesheet_directory_uri() . '/your-stylesheet.css',
            $deps, // optional
            $version // optional
        );
        // since you only want it registered, we won't enqueue it
    }
    add_action( 'admin_enqueue_scripts', 'wp94156_register_styles' );