echo get_permalink(123);
instead of the_permalink()
, provided you know the ID of the “specific page”.
the_permalink()
will always link to the current post in the Loop, and somewhat nonsensically does not take an ID parameter the way that get_permalink()
does.
Reference: https://codex.wordpress.org/Function_Reference/get_permalink