Get the full URL in WordPress

Get the full URL in WordPress

Today, We want to share with you Get the full URL in WordPress.In this post we will show you wordpress get current admin page url, hear for wordpress multisite get current site url we will give you demo and example for implement.In this post, we will learn about wordpress get current url without parameters with an example.

Get the full URL in WordPress

There are the Following The simple About Get the full URL in WordPress Full Information With Example and source code.

As I will cover this Post with live Working example to develop Returning current URL in WordPress, so the php – How to get URL of current page displayed? for this example is following below.

  Form Input Fields Validation using Angular Example

PHP ways to grab the current URL

<?php
  $liveURI = "//" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
?>

Get Current Page URL in WordPress

<?php
  global $wp;
  $liveURI = home_url( add_query_arg( array(), $wp->request ) );
?>

Get current URL (permalink) without /page/{pagenum}/

global $wp;

$liveURI =  home_url( $wp->request ); 

$pos = strpos($liveURI , '/page');

$finalurl = substr($liveURI,0,$pos);


echo $finalurl;

Get current page URL in WordPress

global $wp;
$liveURI = home_url( add_query_arg( array(), $wp->request ) );

/* For example if your website is "https://yourdomain.com/some-post", 
it will return "some-post" */
 
global $wp;
$current_slug = add_query_arg( array(), $wp->request );

Get current URL in WordPress on specific PHP templates

single.php or page.php

$get_object = get_queried_object_id();
$liveURI = get_permalink( $get_object );

taxonomy.php, category.php, tag.php etc

$get_object = get_queried_object_id();
$liveURI = get_term_link( $get_object );
 

author.php

$get_object = get_queried_object_id();
$liveURI = get_author_posts_url( $get_object );

front-page.php or home.php

$liveURI = home_url( '/' );

Web Programming Tutorials Example with Demo

Read :

  Angular 7|8|9 Validate Mobile number With 10 Digits Example

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Get the full URL in PHP WordPress.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.