Slugs not matching but links work
-
I have a WP page which has been generated by a PHP script. This page contains a links to other pages which contain book reviews and whose anchor tags are generated by this statement:
$details .= 'Read the <a href="' . sanitize_title($result->title) . '">review</a> by ' . $result->reviewer;
where ‘$result->title’ is the title of the target page drawn from a database table containing all the details of the books being reviewed. These links work but, in some cases, it seems to me that they shouldn’t as the slug created by the sanitize_title function does not match the slug on the target page (which has a suffix added to it by the system). To give one example:
The title of the target page is: Le nouvel esprit des Jardins
The slug generated by the sanitize_title function is: le-nouvel-esprit-des-jardinsHowever, the slug of the ‘Le nouvel esprit des Jardins’ page is: le-nouvel-esprit-des-jardins-2.
In fact, it doesn’t seem to matter what is in the page slug after ‘le-nouvel-esprit-des-jardins’. I have tried all sorts of combinations and, provided that the first part of the slug is exactly the same as the string generated by the sanitize_title function the link will work. Why is this the case?
The page I need help with: [log in to see the link]
- The topic ‘Slugs not matching but links work’ is closed to new replies.