echo get_permalink($post);
, or the_permalink()
in the Loop context, will give you the canonical URL for the post, without the trailing hashtag part– technically the ‘fragment’.
You could also use PHP’s parse_url
to break the URL apart if *_permalink
functions don’t work for you for some reason, or even PHP’s strpos
and substr
for a really homegrown solution.
Related Posts:
- Facebook Comment Count
- How to get URL of current page displayed?
- Disable Attachment Pages Completely
- Experiences with compiling WordPress using Hip Hop?
- how to get permalink structure with php
- How to Remove Parents Category Permalink from Posts
- add_rewrite_rule with bottom priority doesn’t handle the WordPress pages
- Should I store my Facebook access tokens?
- Put a link to a category round a hard coded A HREF
- How is WordPress manipulating the posts like there are folders?
- wordpress upgrade has broken my permalinks
- Featured image fallback link to permalink
- Do changes to WordPress permalink custom structure affect old urls?
- WordPress custom slug (endpoint) and compare all links
- Add prefix to link url
- 200 Rewrite blog post links
- php script to change slug in post automatically
- wp_trim_words() does not work with my code Am I doing any mistake in my code?
- Changes in permalink structure in WordPress and how to apply to in-site links
- WordPress Persistent connection rule does not work for “posts”
- WordPress every page is 404 not found including admin resources
- WordPress returning 404 for multisite pages
- How to use $_GET function WordPress backend
- wp_head function not outputting
- Create custom permalinks to show Custom Post Type’s relationship?
- How to get post permalink url without a href
- Function returns post URLs rather than retrieving Facebook Graph API data
- stripping tags from excerpt in WordPress is not working
- Liking a facebook page from wordpress website?
- Change product_base programmatically
- Divi change project category slug
- 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
- .html end of URl affected to SEO?
- Search only working on front page (index) , not working on other pages
- how to edit a specific post slug using a php code?
- Creating a Category Taxonomy
- WordPress theme showing blank page
- OG:Audio facebook meta tags
- 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
- Change permalink structure specific category
- understand what code is doing when prepending /blog
- Custom URL for multiple categories hierarchy
- WordPress redirects to localhost
- 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)
- Rewrite rule not working, but only when parameter is text
- 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
- Show Gutenberg facebook embed with a custom theme
- 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
- 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
- What is the proper way to call a function (from functions.php) on a link click?
- How do I generate formatted permalinks as specified in backend options?
- 403 Forbidden Localhost Wamp Apache Php
- How can I add “.html” to the end of a single URL on a WordPress website?
- 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
- add_rewrite_rule questions
- Facebook like update status for wordpress
- Weird slug in archives permalink
- Getting most popular posts based on Facebook comments count
- 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
- Multiple URL from Custom post name
- echo variable containing html and the_permalink();
- append links with unique number string
- How can i call the facebook #hashtag images on my site
- get_permalink returning first letter
- Get permalink for a post from inside WordPress and route to a related site
- custom data in url
- Facebook php sdk 4 getSessionFromRedirect() always null
- Make a permalink to the most recent blog post
- SHARING TO FACEBOOK – FROM DYNAMICALLY GENERATED PAGE
- PHP code for link with text
- Remove /category/ from category (archive) page URLs (without using a plugin)
- Accessing WordPress Functions get_permalink() in Vanilla PHP?
- 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 add Paragraph Tags in WordPress using Visual Composer?
- how to goto specific page number including title with permalink
- WordPress 6.1.1 UTF8 Slug Limit Increase
- why css file not link?how to create permalink?