On my current, I have this “martygeocoderaddress” custom fields and it contains a string with Queen Anne’s. On my JS code below
Wrong
html += ''; html += '<?php echo get_post_meta( $product->id , 'martygeocoderaddress' , true ); ?>'; // Output is 'Queen Anne's' which is wrong and this can't be read by your JS code. By using this htmlentities( 'string', ENT_QUOTES );, the "'" will convert to '.
Correct
Example
html += ''; html += '<?php echo htmlentities( get_post_meta( $product->id , 'martygeocoderaddress' , true ), ENT_QUOTES ); ?>'; // Output is 'Queen Anne's' which is correct. No conflict on JS.
Leave a Reply