Support » Plugins » Hacks » no_texturize_shortcodes filter

  • Resolved shawmutsteve

    (@shawmutsteve)


    We write Rover IDX, a plugin to display real estate listings on WordPress sites. Agents all across the USA use the plugin, but we regularly run into a problem with curly quotes / smart quotes.

    If the user (often a real estate agent) is copying a Rover shortcode to their page, that shortcode example may have parameters – [rover_idx_full_page items_per_page=”24″]. If the website or email they copied it from has curly quotes ‘on’, the agent will paste those curly quotes into the page. Most people do not notice the curly quote (the difference is subtle), and trying to explain that they need to be corrected does not go so well. These ‘texturized’ quotes really mess up the parsing of shortcode parameters.

    We’ve just implemented the no_texturize_shortcodes filter – but I *think* this filter will avoid converting a double quote to a curly quote (on the page save). But if the agent pastes a curly quote – this filter does not correct it. Is my understanding correct?

    Also – the shortcode parameters are parsed by WP, and sent to the plugin. So they are already messed up. Is there an elegant way to ensure the correct parsing of shortcode $atts that may have been polluted with curly quotes?

    Thank you
    Steve

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    You are correct about the no texturize filter, solves one problem but doesn’t help your immediate problem.

    The best solution I can think of is to use the ‘wp_insert_post_data’ filter to search for your shortcodes in the content and ensure there are no curly quotes before the closing ] . Search not only for the UTF chars but the HTML entities as well, since you’ve no idea the charset they pasted from. That doesn’t totally solve the charset issue, that’s a can of worms! It might not hurt to search for curly quotes in the most common non-UTF charsets in your region.

    Thread Starter shawmutsteve

    (@shawmutsteve)

    Very helpful – thank you

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘no_texturize_shortcodes filter’ is closed to new replies.