Support » Themes and Templates » Shortlink
5 years, 4 months 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“
Assuming that this is within the Loop, try using <?php echo wp_get_shortlink(get_the_ID()); ?>.
<?php echo wp_get_shortlink(get_the_ID()); ?>
This is my code:
[Code moderated as per the Forum Rules. Please use the pastebin]
Does anyone have an idea on how this can be done?
Figured it out. Got the answer here: