WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Shortlink (5 posts)

  1. 3Plumes
    Member
    Posted 2 years ago #

    Is there a way to display the shortlink? I'm using:

    <?php the_shortlink('####', null, 'Short Link: ', null); ?>

    It returns, "Short Link: ###" and I would like to return "Short Link: http://example.com/?p=2704"

    Thanks

  2. esmi
    Forum Moderator
    Posted 2 years ago #

    Assuming that this is within the Loop, try using <?php echo wp_get_shortlink(get_the_ID()); ?>.

  3. 3Plumes
    Member
    Posted 2 years ago #

    This is my code:

    [Code moderated as per the Forum Rules. Please use the pastebin]

  4. 3Plumes
    Member
    Posted 2 years ago #

    Does anyone have an idea on how this can be done?

  5. 3Plumes
    Member
    Posted 2 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags