Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I can't seem to find this anywhere, Is there a way to retrieve the URL of the post (which is of a custom post type) you are editing. Basically I want to somehow get the same URL that shows up like this: Permalink: (link to post) on the edit screen.

share|improve this question
1  
Did you mean add the link in the admin panel for editing posts? There should be a view post link there already. –  miahelf Oct 13 '12 at 6:17

1 Answer 1

up vote 0 down vote accepted

You should have the $post variable (you may need global $post;) from which you can get the post ID ($post->ID). Then $perm = get_permalink( $post->ID ); should give you what you want.

https://codex.wordpress.org/Function_Reference/get_permalink

share|improve this answer
    
Thanks! Had to use $global for those future viewers :) –  Chris Oct 13 '12 at 12:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.