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

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 suggestions, 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' );
 
}

The Task
Just for your understanding

Step 01
on customizer save action Script will Detect Active Theme
Step 02
Create CSS File with ‘customizer CSS’ in the Active Theme and also upload it to Uploads Folder
Step 03
Remove/stop rendering the Header style-tag for customizer CSS
Step 04
enqueue the created CSS file into the active theme

0
WeDevelop 4 months 0 Answers 13 views 0

Leave an answer