What is the difference between get_permalink vs get_the_permalink?

What is the difference between get_permalink vs get_the_permalink?

1
1

Nothing.

get_permalink() is the original function, and is used to get the permalink URL for a post.

get_the_permalink() was introduced in 3.9 simply so the permalink function was consistent with the other post-related template tags, such as get_the_title(), get_the_content(), which are all prefixed with get_the_.

The equivalent functions for echoing the result of those functions are the same but without the get_, such as the_title(), but in the equivalent for get_permalink() is not permalink(), it’s the_permalink(), so the lack of get_the_permalink() was an inconsistency.

Using the function just calls get_permalink(), which still exists for backwards compatibility reasons, so the result will be exactly the same.

Leave a Comment