-1

I’m building a custom WordPress theme and currently adding CSS and JS directly in header.php.

I read that wp_enqueue_style and wp_enqueue_script should be used instead.

Can someone explain the correct way to enqueue files and why it’s preferred?

asked 38 mins ago

Shubha Rawat's user avatar

New contributor

Shubha Rawat is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

Sign up or log in

Sign up using Google

Sign up using Email and Password

Post as a guest

Name

Email

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.