the_permalink()
prints url immediately and returns nothing, you should use get_the_permalink()
function, which returns current post url.
the_permalink()
prints url immediately and returns nothing, you should use get_the_permalink()
function, which returns current post url.