WordPress – Get The Current Page URL

In WordPress, if you want to get the current page URL on any page, then here is a small snippet you can use. It works on all the pages, be it a single post page, a single page, a category page, home page, or any other page.
One more advantage of using this code is that it cleans the URL, and gives you the output free of query variables. Use this code in your theme/plugin to get the current page URL in WordPress.
Happy coding 🙂
Related Post