What you need is get_permalink
, e.g.
$current_post_url = get_permalink();
You can either use it inside a post loop, or pass it a post ID as a parameter.
Related Posts:
- Changes in permalink structure in WordPress and how to apply to in-site links
- get_template_directory_uri() providing wrong path for img
- What is the proper way to call a function (from functions.php) on a link click?
- PHP code for link with text
- Create custom permalinks to show Custom Post Type’s relationship?
- Make Current/Active Page Number a Link (WP_LINK_PAGES)
- Trying to prepend a Hashtag symbol to the_tags links [closed]
- Next post link on a bootstrap button
- stripping tags from excerpt in WordPress is not working
- trouble with page_id & highlighting current page
- Change product_base programmatically
- Divi change project category slug
- How to use the wpsnonce clone post link?
- Extract links from content
- Custom post type permalinks do not appear using the link functions
- How to Handle Going Backwards in Navigation When Referrer in PHP/JavaScript won’t work?
- Remove slugs from custom posts type
- Automatically Add Page Links to Nav Menu
- .html end of URl affected to SEO?
- Search only working on front page (index) , not working on other pages
- with PHP within splits the link
- how to edit a specific post slug using a php code?
- Creating a Category Taxonomy
- WordPress theme showing blank page
- Adding custom url to readmore link using get_permalink()
- Strip hashtag off permalink with php
- Insert PHP code in Text
- Permalinks: site.com/post-tite vs site.com/post-id/post-title for SEO and Speed
- Can not call .php files after switching to %postname%
- WordPress permalink issue
- How to set all External Domain Links with nofollow Attribute from Header Footer Content and Excerpt using PHP?
- Change permalink structure specific category
- Obfuscate links (for SEO purpose) [closed]
- understand what code is doing when prepending /blog
- Custom URL for multiple categories hierarchy
- Adding wp users ID into a link address from a DIVI modul
- WordPress redirects to localhost
- Allow two posts (from different categories) to have the same slug
- Test the existence of a page/article by its URL, taking in consideration the URL rewriting by filters
- 404 on old link after changing post url
- url not using query string no longer working
- Custom PHP form needs refresh to load page correctly
- Child-Theme Category View with modified permalinks (%category% removed)
- How to enable HTML tags in category description without breaking the category page
- Rewrite rule not working, but only when parameter is text
- opens like sitename.com/URL
- Link to index.php from home.php?
- How does Permalink work with the AMP plugin after Removing Parent Permalink Catalog from Posts
- Get WordPress username to customize url
- Permalink doesn’t navigate to post (changes only url)
- Post permalink buttons all going to the first post
- Permalink changes after several minutes after saving post
- How to edit button permalink inside function.php using a child theme?
- WordPress/NGINX not respecting the category URL for new posts
- WordPress generates weird permalinks
- Display child-page links in sidebar on both Parent Pages AND Child Pages
- Permalink like example.com/taxonomy/post_type/postname
- How do I stop my form from adding code to current page URL instead of re-directing. Been stuck for days
- image on homepage disappeared due to change of permalink name
- Custom content using in_category
- Change username link in admin bar
- Multisite – Display different header content based on which site is accessed
- How do I generate formatted permalinks as specified in backend options?
- 403 Forbidden Localhost Wamp Apache Php
- Passing parameter from the current URL to redirect to another url
- Wrapping shortcode content in a span or link
- how to remove replicating a tag inside loop?
- changing static link to relative link
- redirect 301 with special character like WIX site “#!”
- Permalinks and custom PHP application
- How to solve 404 permalink errors on nginx server
- Some links broken after updating WordPress version
- Links in footer section
- add_rewrite_rule questions
- How to change this internal image link parameter using PHP?
- problem with category menu, it doesn’t want to show link
- Weird slug in archives permalink
- WordPress Rewrite Issue
- Would it be possible to route WordPress Through an MVC Application
- Newly published content gives 404 on wordpress
- set new link as permalink
- Make first child link default instead of its parent
- Multiple URL from Custom post name
- echo variable containing html and the_permalink();
- How to link a word comprised of a custom field with another?
- append links with unique number string
- get_permalink returning first letter
- Get permalink for a post from inside WordPress and route to a related site
- custom data in url
- Make a permalink to the most recent blog post
- Link to external page has wordpress blog-url inside
- Remove /category/ from category (archive) page URLs (without using a plugin)
- Accessing WordPress Functions get_permalink() in Vanilla PHP?
- PHP Button Custom link [closed]
- WordPress add parameters with friendly url structure
- Add any username as link prefix and show data from that specific user’s profile on wordpress pages – with no login required
- how to goto specific page number including title with permalink
- How to extract URLs from wordpress taxonomies
- Remove content links (internal and external), but exclude post at specific categories
- WordPress 6.1.1 UTF8 Slug Limit Increase