MultiDev
MultiDev

Reputation: 10649

WordPress: How to include & symbol in an escaped url

I am trying to include a stylesheet in my theme:

wp_enqueue_style('colors-css', '/root/assets/css/colors.css?style=blue');

The problem is, WordPress escapes this, and adds a version number onto the end. So, instead of having this:

/root/assets/css/colors.css?style=blue&ver=3.9

I end up with this:

/root/assets/css/colors.css?style=blue&ver=3.9

What do I do to correct this so the URL is rendered correctly?

Upvotes: 0

Views: 79

Answers (1)

Brad
Brad

Reputation: 163314

If the output that you're seeing is in your HTML, then it is correct. & is a reserved entity and can be encoded as & or &.

The browser will never send & in the URL for the request. It will be interpreted as &, as you intended.

Upvotes: 3

Related Questions