I am trying to turn a standard wordpress title into a slug, that makes all characters lowercase, replaces spaces with dashes, and removes all "&" symbols that are in the titles.
So lets use this title as an example: "Identity & Wayfinding"
Here is my PHP:
<?php
$title = get_the_title();
$lower = strtolower($title);
$noDash = str_replace(' ', '-', $lower);
$noAnd = str_replace('&', '', $noDash);
echo $noAnd;
?>
This turns my title into "identity-#038;-wayfinding"
The lowercase conversion worked, but the replacing of the"&" with nothing isnot working . It is converting the "&" into an HTML special character. Any idea how I can simply replace the "&" with a blank, but also REMOVE the dash after that so the final title would be: "identity-wayfinding"?