• php code is showing up in the og: description when viewing the browser source (view source). I can do a work around by not putting code at the beginning of the page. in this case i have to include text long enough to max out the og:description field. is there any other way to avoid this? it’s inconvenient but also makes me nervous that code is showing up in view source. thank you. by the way, your plugin saved my life! thanks.

    https://wordpress.org/plugins/insert-php/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Sorry, Malaga, but I’m uncertain what an og:description is.

    Insert PHP is for posts and pages.

    If you see the PHP code in the browser source code of the post or page, it means the PHP code hasn’t run. And yes, you should be nervous about that; and either find out what’s causing it or not use Insert PHP.

    The code in Insert PHP should run when the post or page is generated for output to the browser.

    Will

    Thread Starter malagasmith

    (@malagasmith)

    Thanks for the quick response Will. the og: property is what browsers look for now mostly for social media and the like – it pulls the first part of the page into a description field. Here’s a basic info page http://ogp.me/

    So the code is running – everything works great – but the browser is picking up the first few lines even though it’s in between the insert_php tags.

    OK, looks like the browser picks up the content before the plugin kicks in and runs the PHP code.

    Yes, looks like you’ll need enough content above the PHP code to satisfy the browser so none of it gets picked up.

    Will

    Thread Starter malagasmith

    (@malagasmith)

    ok, thanks. i’m also going to check to see if i can adjust this theme to programmatically insert the og tag but this theme is pretty well locked down so might not be possible. thanks for the quick responses.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘code showing in og: element in browser view page’ is closed to new replies.