• Resolved KZeni

    (@kzeni)


    I have a shortcode [location] that’s set up in Post Snippets. I want it to be able to have content pulled from the editor, have the shortcode execute PHP code, and have it possible to have an apostrophe in the content.

    For example, I have

    
    [location category="food"]
    
    <strong>John's Rib Shack</strong>
    123 Fake St.
    
    [/location]
    

    which is then passed through some PHP for determining other factors on the shortcode (ex. change the output depending on the category attribute).

    Currently, I am unable to assign the content to a variable in my PHP code while using PHP 7.1 due to a fatal error since the apostrophe in the content escapes the variable string & then causes an error when eval’d. I tried wrapping {content} in htmlspecialchars(), but that still didn’t work.

    Just wanted to let you know about this so it can be investigated & resolved since I’d imagine people would want to use apostrophes in a scenario like I described without the page it’s used on breaking.

    Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Apostrophes in {content} that’s then used in PHP shortcode cases fatal error’ is closed to new replies.