If you want to display the current permalink outside The Loop, then do the following:
- Access the global
$post
variable get_the_permalink($post->ID)
Youf code as follows:
global $post;
echo get_the_permalink($post->ID);
Related Posts:
- Change media item permalink
- Creating custom permalink structure for languages
- Permalink not working for page without title
- What is the difference between get_permalink vs get_the_permalink?
- Is the permalink structure /%post_id%/%postname% faster or slower than just /%postname%?
- Post titles not letting me use 2 consecutive dashes in permalink
- Using underscores instead of hyphens in the permalink
- How can I force WordPress to redirect to canonical permalinks?
- 404 on category.php pagination
- flexible rewrite ‘ramble’ URLs with WordPress
- Changing pemalink structure to /%post_id%/%postname%/
- Posts not working on windows after changing permalinks
- Custom permalink structure
- How to get rid of index.php?
- Relative or Absolute Paths for Flash Video Player Files
- Update Old Links To Pretty Permalinks Custom Post Type
- WordPress Permalinks %postname% for RSS2 Feed URL
- remove permalink trailing slash
- Use Single Blog Post as Site Front Page Without Redirect
- wordpress permalinks tweeks
- generate custom permalink based on a custom field
- Redirect old permalinks with Month and name to Post name on new site
- .htaccess – Redirect duplicated post ended in ‘-number/’ to the same url without the -number/
- WordPress Permalinks on Mac OSX Server 5 (El Capitan)
- How to find out who handles a permalink?
- Getting links to work the same on development and production
- Permalink /%category%/%postname%/ returns 404 on OSX
- Page Attachment Permalink Structure based on Menu Order?
- stop the_permalink printing and save as variable?
- Change author slug and functionality
- Setting up two separate blogs while using WordPress as a CMS
- Custom theme navigation
- get permalink and append it
- How to redirect to correct pages after permalink structure change
- Moving local wordpress page to a real server subdomain broke my permalinks?
- Remove parent category from permalink but keep breadcrumbs structure
- Only plain permalinks working
- next_posts_link URL does not include name of custom post type
- Media Gallery Images – safe to change permalink?
- How to remove specific category from URL in WordPress
- How to set permalinks when posts and pages have different URL structures?
- redirect/ %category%/%postname%.html to /%category%/%postname%
- WordPress disallows changing page to a specific permalink
- Permalink Doesnt Work – URL Not Found
- WordPress 4.4 old permalink redirect
- 404 when going to /blog
- WordPress keeps giving me the wrong permalink
- Permalinks 404 error with HTTPS host
- Empty permalinks settings in .htaccess
- Rewriting single post url; add_rewrite_rule problem?
- curl problem or permalinks
- Echo title with permalink
- Multiple permalinks
- Redirect From Url To Url
- how do prevent wordpress from creating permalinks for media files
- custom query var NOT working on a plain permalink: http://10.8.10.9/?page_id=1774/?location=968&floor=1
- How to flush Global query variables in wordpress?
- How to disable permalinks to some custom post content?
- Changing permalink structure and domain
- How to add a base/front slug/url to specific post types?
- How to use page jumps to top of banner and page title?
- Permalinks problem woocommerce no separating slash between categories
- Permalinks not working in WordPress
- Why does enabling Permalinks make pages not found?
- Problem by $output and permalinks
- Permalinks by Post Name Are Not Working
- Pretty permalinks and Facebook comments
- WordPress upgrade from 2.7 to 3.3 Permalink problem
- Change url of page according to my requirements in wordpress
- I use wordpress wp-page navi
- Multiple Taxonomy Items for Separate URLs
- MySQL-inserted custom taxonomy term lead to 404, flush rewrites doesn’t help
- Post name permalinks File not found — Mac High Sierra
- Permalink issue with WordPress Site at domain root and another WordPress Site in a Subfolder
- Custom optional parameter in page URL
- Posts containing a specific tag and a category in one permalink
- Custom permalink question
- How to search for images and get it’s link?
- Remove index.php from URL (WP installed in subdirectory)
- Page returns 404 for specific permalink
- issue with the_permalink
- Pagination links for taxonomy archive page 404 error on every page except first
- Facebook Share Permalink Javascript href
- Change all pages permalinks instead of hierarchical to have id of the page
- where is the media permalink info stored in database?
- Links after changing hosting and domain
- How can I get WordPress CPT archives and page templates to work with prettified permalink settings?
- Passing user defined variable into get_permalink
- Custom Permalinks and filters?
- Custom permalink structure for custom post type results in 404
- ?posts_type=xxx not rewritten
- Change permalink when page category selected in admin
- Category pagination first link works, remaining don’t
- Custom rewrites for pages and categories
- WordPress home page showing 404 error
- Why doesn’t my page know it’s a page (won’t return true for is_page())?
- How to change my URL on intranet
- AllowOveride All causes assetts and Admin Urls to 404
- How to make my custom permalink pull up the correct post
- How to Set Both Category and Sub-Category Level at Root. It should also obey post rule as /category/sample-post and /sub-catgeory/sample-post?