Developers or bloggers using WordPress might need to get WordPress current page url to use it somewhere in their website code, theme or plugin, etc.
The url can either be used in theme for permalink or for any other reason in functions file or a plugin (sharing plugin for example).
How to get WordPress current page url (Permalink)
The php code for getting current page link in wordpress is :
<?php echo get_permalink(); ?>
However if you need to get the permalink for some other post or page then it can be done by passing that particular page id to wordpress through this function like this:
<?php echo get_permalink( $id ); ?>
I hope this would be helpful for someone who need to get WordPress current page url or permalink. Let me know if you have any query.