Community Forums › Forums › Archived Forums › General Discussion › Changing the og:url tags to http to retrieve social media numbers
Tagged: https://, meta tags, open graph, social media numbers
- This topic has 7 replies, 2 voices, and was last updated 7 years, 5 months ago by Brad Dalton.
-
AuthorPosts
-
April 6, 2017 at 7:55 pm #204414David BorrinkParticipant
After upgrading my web sites to https, I've run into the unexpected loss of social media numbers.
I was advised by a Sumo rep on the WordPress boards to manually make my og:url meta tags point to the http version of our site instead of https. But I got a weird problem. In my <head> area in the Genesis settings panel, I have these meta tags settings…
<meta property=“og:url” content=“http://sallieborrink.com” /> <meta property=“og:title” content=“Sallie Borrink />
But when I check the source code, it comes up as…
<meta property=“og:url” content=“https://sallieborrink.com” /> <meta property=“og:title” content=“Sallie Borrink />
Something is putting the s back into the http, even though I didn’t put it in there. And what makes this even weirder is that I tried changing the url to
http://salliexborrink.com
just to make it different, and it showed up as http in the source. But, change it back to the correct url ashttp://sallieborrink.com
and the https returns.I’m baffled. That’s the only place in the source code that has the og:url tag. What could be causing this kind of behavior?
https://sallieborrink.comApril 6, 2017 at 9:02 pm #204416Brad DaltonParticipantYou could use str_replace to change the https to http.
Or
You could remove the s using substr
Or even preg_replace
April 7, 2017 at 9:29 am #204438David BorrinkParticipantWouldn't that change all instances of my URL, even in the content? I want to be able to change that in the og:url spot in the meta property that goes in the head, not wanting it to change all urls in my content.
Obviously I'd be using this, correct? ...
<?php echo str_replace("https","http","https://sallieborrink.com"); ?>
April 7, 2017 at 5:44 pm #204468Brad DaltonParticipantDavid
I would filter the og tags using one of the functions i suggested above. Thats my suggestion.
The og tags are added via a plugin not WordPress or Genesis.
April 7, 2017 at 8:29 pm #204481David BorrinkParticipantThanks for the reference to the W3 PHP pages.
Okay, so I see how they all can work. So if I'm filtering a og tag, how would I syntax that in functions.php? Obviously if I just do https://sallieborrink.com, I'm going to be affecting every instance in the site, content an all, correct? Do I need to put the whole meta tag in the function, then define where to strip it out?
April 8, 2017 at 4:41 pm #204507David BorrinkParticipantOkay, I tried this in my functions.php file:
echo str_replace("http","https","meta property=“og:url” content=“https://sallieborrink.com” /");
And I got this across the top of my page above the header:
meta property=“og:url” content=“httpss://sallieborrink.com” /
And the source code read"
<meta property=“og:url” content=“https://sallieborrink.com” />
I'm obviously not doing this right.
April 8, 2017 at 9:35 pm #204509Brad DaltonParticipantYou need to use the filter applied in the plugin to modify the default output. Thats something you'll need to get from the plugin developer or dig into the plugin and find.
April 8, 2017 at 9:43 pm #204510Brad DaltonParticipant -
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.