This is exactly the type of scenario shortcodes are intended for. Simply add the following to your theme’s functions file to create the shortcode:
add_shortcode( 'this_permalink', 'this_permalink' );
function this_permalink($atts, $content){
return '<a href="'. get_the_permalink() .'">Link to this article</a>';
}
.. and use this in your post to render the link:
[this_permalink]
I cannot think though, why you would want to link to a current article, but I guess you have your reasons 🙂
Related Posts:
- shortcode to output multiple images urls from media library id
- Get new WordPress slug from old wordpress slug
- WordPress basic functions show on top in custom shortcode
- Is there a way to show attachment IDs on the attachment info screen?
- Shortcodes not working
- Do shortcodes in title before permalink is generated
- get_posts displaying wrong permalink for “continue reading” link
- Need help with add_rewrite_rule
- How to get pretty URLs with add_query_arg in permalinks
- Prevent WordPress from abbreviating-long-slugs…-in-the-admin
- Page begins with number, WordPress adds 2
- Permalinks to Custom does not work (out of box)
- Why don’t WordPress post slugs allow accents?
- Multi-language permalink in qtranslate
- How to add query parameters to all internal links?
- How to make draft posts or posts in review accessible via full url / slug?
- Modify get_permalink with a specific filter
- How to set permalink to fetch all children custom posts with parent post in wordpress?
- How to change the link structure of the homepage?
- WordPress on VirtualBox – no pretty permalinks
- permalinks has -2 with post name structure. why?
- Child pages with same slug
- Permalinks, Rewrites, Get Variables, Oh My!
- Remove words from permalink when saving post automatically?
- Permalink problem
- Rewrite my default post URL
- Removing leading zeros from custom permalink structure
- Get permalink to page?
- Parent Category link to its sub categories on different page
- How to reset canonical URLs / fix redirect loop
- Permalinks: Page Not Found
- Trailing slash at the end of permalink loads faster / better SEO?
- wordpress api using rest_route for other pages
- 301 Redirects Result in 404 for WordPress Search Query Strings
- After updating to 4.8 permalinks will not work (all 404)
- Remove custom taxonomy base from URL
- How to get post object on blog template
- Editing URL character replacement
- How to make /search/ without parameters not return a 404?
- WordPress auto generates small medium and large of an image on upload, how can we guess their links?
- Get post text (by its URL) from database dump
- Plain to postname permalinks not working
- WordPress archive permalink with leaf category
- Google webmaster duplicate url issue with /page/01 /page/400
- URL rewriting: removing the site’s basename for a specific category
- Migrated from Windows to Linux. Any bulk methods for fixing case sensitivity?
- All top-level pages are using index.php as template
- Redirect all posts permalinks from “.html” to “/”
- Unable to get /%postname%/ permalinks working, 404 on all links
- How to rename ‘Tag Base’ with WPeC 3.8?
- Custom rewrite rule ignored
- Stop Images Linking to Themselves?
- Resolve 404 on posts without category
- Inserting a string in the middle of page’s permalink?
- When I click on a single post my browser goes to about:blank#blocked and the page is white
- 404 on internal pages, in all sites in my local server
- how to alter permalink in wordpress?
- Pagination using paginate_links
- add_rewrite_rule – Page Slug from “/foo-bar/” to “/foo/bar/”
- Permalink will not change – it wants to have -2 slug [duplicate]
- Permalinks 404 after Subdirectory to Root Migration
- Access or edit custom generated permalinks with WP_Rewrite
- Add custom query vars to pretty permalinks
- xammp server permalink by postname not working
- Redirect after permalink changes
- Custom permalink structure only saves with index.php inserted
- the_permalink() not working
- Permalinks and page store
- All in One Seo and Permalinks
- Already have htaccess but permalink settings not working. Getting 404
- Add .html permalink to post if specific category
- rewrite based slug standar post wp
- How to update wordpress permalink structure with author role?
- How to turn a custom query string into permalink?
- How can i fix my permalinks?
- Custom structure permalink preventing 404
- Flush rewrite rules with scheduled event (cron)
- I have a 404 error on all my pages! What do I do?
- Add slug to default post permalinks ONLY
- Getting 400 Bad request Error when trying to open posts after updating to wordpress 5.0
- Category Base permalinks
- Propper way to set anchor and url param
- Pretty Filter URL
- Add URL to selected post in meta box
- How to change dynamic link to relevant post
- Auto-generated pretty permalink not using title since 4.4 update
- Problems with permalinks after update wordpress 4.2
- Pretty permalinks to work for lighttpd webserver?
- Customize category permalinks
- Latin character conversion
- Update permalinks
- Losing the original URL when using add_rewrite_rule
- broken permalinks in responsive layout
- permalinks url with woocommerce
- How to get the perfect WordPress, WooCommerce, Custom Post Type pretty permalinks?
- WordPress keep redirecting me to random URLs
- Not recognizing my custom templates in hierarchy
- How to make a permalink variable %year% become two digits instead of four digits?
- Standard Htaccess directives disappear by themselves
- My permalinks no longer have the “news” category prefix in the link and it’s causing 404 errors for articles published on the web