I managed to get duplicate slugs to save, but can’t get the above code to work. $wp_query->post_count
is always 1, even when there are two pages with the same slug. Is there something I’m doing wrong?
It seems like the best solution would be a query like: WHERE post_name = %s AND language_id = %d
. Then slugs wouldn’t be ambiguous on the front-end. But I have no idea how to make that kind of change.
Edit: Forgot to say that I’m trying to get this to work for pages, not blog posts.