Domas
Domas

Reputation: 1133

Including ampersand in URL in WordPress

I have a page name that does not include an ampersand, but I need its URL to inluce one. I have tried using %26, which changes the url in page editor, but does not really create a proper URL.

Is there a need for some plugin or can it be done simplier?

Any help or guidance is much appreciated.

Upvotes: 2

Views: 1952

Answers (2)

Marc
Marc

Reputation: 21

If you are talking about javascript inside post/page... \u0026 works!

Upvotes: 2

Bud Damyanov
Bud Damyanov

Reputation: 31919

In order to comply with HTML specifications, you need to encode all special characters (not only ampersands) in URL.

See the official table here with all character encodings.

This can be done manually, or automatically with PHP function urlencode().

Upvotes: 1

Related Questions