[Plugin: Contact Form 7 Dynamic Text Extension] Escaping ' and " in dynamictext fields
I am using dynamic text to autopopulate form fields based on variables in the URL. For example, ?name=Jane returns “Jane” in the “Name” field in my form. But when I have a variable with a special character in it, such as a single quote, the quote is escaped with a backslash, so ?name=Jane’s Office becomes “Jane\’s Office” in the field.
I think this is a function of WordPress, because it happens on other pages as well. Special characters get sanitized to prevent malicious code from being passed in the URL. The only way I’ve found to solve that elsewhere on the site is to wrap the resulting key in “stripslashes()” in the shortcode, though this still allows malicious code, and it’s not my favorite method. Regardless, I don’t know how I would do this with dynamic text extension.
Does anyone know of a way to fix this so my variables don’t appear with backslashes when displayed in the HTML or in form fields? I’m having trouble finding the right answer.
- The topic ‘[Plugin: Contact Form 7 Dynamic Text Extension] Escaping ' and " in dynamictext fields’ is closed to new replies.