How to save the Additional CSS in a CSS file and enqueue it

Question

In Appearance -> Customize there is an option for additional CSS where we can add CSS and save it. I am trying to save this CSS to a file, not into the database and enqueue it. I have successfully enqueued a CSS file but unable to create and update it dynamically. Any hints, please?

add_action( 'wp_enqueue_scripts', 'my_external_styles' );
function my_external_styles() {
 
    wp_register_style( 'my-css', get_stylesheet_directory_uri().'/my.css' );
    wp_enqueue_style( 'my-css' );
 
}
0
WeDevelop 4 months 0 Answers 14 views 0

Leave an answer