Divi WordPress Theme
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

WordPress fix Reply To: How to make wp_enqueue_scripts generate relative path?

Discussion in 'Misc WordPress Requests' started by qwazzy, Jan 18, 2018.

  1. qwazzy

    Guest

    Reply To: How to make wp_enqueue_scripts generate relative path?, by qwazzy

    Yes, but how do I make wp_enqueue_style and wp_enqueue_script generate <style> and <script> tags with relative urls instead of absolute? When I pass relative url to wp_enqueue_style/script it comes out absolute. For example:

    wp_enqueue_style( 'my-theme-style', get_theme_file_uri('/assets/css/theme.css'), array(), null, 'all' );

    generates this tag in the <head>:

    <link rel='stylesheet' id='my-theme-style-css' href='http://mysite.test/wp-content/themes/mytheme/assets/css/theme.css' type='text/css' media='all' />

    What I’m looking for is to make it generate href with relative url, like this:

    <link rel='stylesheet' id='my-theme-style-css' href='/wp-content/themes/mytheme/assets/css/theme.css' type='text/css' media='all' />

    Reply To: How to make wp_enqueue_scripts generate relative path?
     
    #1

Share This Page

Monarch Social Sharing Plugin