I guess your problem is that when using the apostrophe in the url, WordPress rewrite rules recognize the post name containing the apostrophe.
You can verify that using print_r( $wp_query->query );
.
If my guess is correct, the ‘name’ query param contain %E2%80%99
, so WP will look in the db for a post whose slug contains the encoded apostrophe, but (by default) post slugs before being saved are filtered with sanitize_title
and so %E2%80%99
is stripped out and the post is not found.
You can force WP to save %E2%80%99
in the slug, but I’m afraid that will explode in your face first or later, because WordPress always expect a sanitized slug.
If mantaining the url is important, you can use a filter on 'parse_query'
to sanitize_title
the ‘name’ query var:
add_action( 'parse_query', function( WP_Query $query ) {
if ( ( $name = $query->get('name') ) ) {
$query->set( 'name', sanitize_title($name) );
}
} );
An then the url with apostrophe should work.