WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] get_the_permalink not working? (5 posts)

  1. madskjaer
    Member
    Posted 4 years ago #

    I need to output the permalink to a variable, and I would think this could be done like so:

    $output .= get_the_permalink();

    But it doesn't seem to work. I can't find any help in the Codex, which doesn't even mention get_the_permalink. Is it even a wordpress function? Any suggestions?

  2. MichaelH
    Member
    Posted 4 years ago #

    Need to use get_permalink() with the id of the post:

    $permalink = get_permalink($post->ID);
  3. madskjaer
    Member
    Posted 4 years ago #

    Thank you :)

  4. blogmum
    Member
    Posted 4 years ago #

    Thanks from me too :-D

  5. hallipa
    Member
    Posted 4 years ago #

    +1.

Topic Closed

This topic has been closed to new replies.

About this Topic