I'm looking for a way to redirect to a specific wordpress page without knowing the ID.
I have a shortcode that is meant to redirect to a registration page once a button is clicked.
Before, I was able to just use a page ID. Now I am using WPML and the page ID's are all different for each language.
How can I redirect to a specific wordpress page without knowing the specific page ID for the current language?
Maybe you could use
get_page_by_path()
orget_page_by_title()
.Both functions accept Post Type as argument, it's not only restricted to "pages". And they will return a full
$post
object, ie,$post->ID
.Maybe a WPML function is needed, an equivalent of those. Or maybe a combination.
See the docs for Language dependent IDs.