Функция get_post_permalink() в WordPress с примерами.