zel
zel

Reputation: 165

Cannot get current URL in php function get_meta_tags

I have a little problem with get_meta_tags. I want to include it on several sites, so it must take meta from current site.

$current_site = $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
$tags = get_meta_tags($current_site);

Tried to do this that way (when I echo $current_site i get the proper address), byt can't get metatags when using it :(

Upvotes: 1

Views: 578

Answers (1)

JClaspill
JClaspill

Reputation: 1745

Since your site is all https, you should add https:// to the front of your variable.

$current_site = 'https://'.$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"];
$tags = get_meta_tags($current_site);

Upvotes: 1

Related Questions