get_permalink, needs an id as a parameter, get_the_permalink uses the current post id. https://developer.wordpress.org/reference/functions/get_permalink/ https://developer.wordpress.org/reference/functions/get_the_permalink/