A
A
Anton2015-09-29 03:19:13
PHP
Anton, 2015-09-29 03:19:13

How to get current page url in wordpress?

Hello. There is a multisite on WP with identical structure in different languages. How to dynamically get the url of the current page (maybe there is some function for the template), so that when redirecting it does not redirect to the root of the site, but redirects to the same page, but on a new domain. For example, from example.com/page1 to subdomain.example.com/page1

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel K, 2015-09-29
@DigitalEmotions

Either through get_permalink( $post->ID );
or by standard means

$Path=$_SERVER['REQUEST_URI'];
$URI='http://site.ru'.$Path;

For redirection, the WP has WP_REDIRECT
Well, there is a ready-made plugin to help: https://ru.wordpress.org/plugins/language-redirect/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question