[wp-trac] [WordPress Trac] #29608: wptexturize messes up shortcode with parameter meta_compare=">="

WordPress Trac noreply at wordpress.org
Tue Sep 9 21:22:58 UTC 2014


#29608: wptexturize messes up shortcode with parameter meta_compare=">="
--------------------------+--------------------
 Reporter:  bobbingwide   |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  4.0.1
Component:  Formatting    |     Version:  4.0
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+--------------------
Changes (by SergeyBiryukov):

 * milestone:  Awaiting Review => 4.0.1


Old description:

> This is a direct follow on to #28564.
>
> I have a number of shortcodes where I pass args to get_posts() almost
> directly from the shortcode.
>
> In one particular example I use meta_compare="<" to display posts which
> are earlier than a certain date.
> In another I use meta_compare=">=" to show posts on or greater than the
> date.
>
> In WordPress 4.0 the ">=" meta_compare has stopped working.
>
> '''Expected result:''' WordPress 3.9.1
>
> [shortcode meta_compare=">=" ]
> will end up passing a meta_compare value of >= to get_posts(). i.e.
>  [meta_compare] = >=
>
> '''Unexpected result:''' WordPress 4.0
>
> the array field value passed to get_posts() becomes
>   [meta_compare] => ’>=’
>
> This problem is caused by wptexturize(), which converts a double quote to
> ” or a single quote to ’
>
> Pragmatic workaround:
>
> {{{
>  remove_filter( "the_content", "wptexturize" );
> }}}
>

> Alternatively, I could introduce a specific test on the meta_compare
> parameter value and strip unexpected entities.
> I may have to do this anyway since I've seen a situation where the visual
> editor  has converted > to > which has caused a similar failure.

New description:

 This is a direct follow on to #28564.

 I have a number of shortcodes where I pass args to get_posts() almost
 directly from the shortcode.

 In one particular example I use meta_compare="<" to display posts which
 are earlier than a certain date.
 In another I use meta_compare=">=" to show posts on or greater than the
 date.

 In WordPress 4.0 the ">=" meta_compare has stopped working.

 '''Expected result:''' WordPress 3.9.1
 {{{
 [shortcode meta_compare=">=" ]
 }}}
 will end up passing a meta_compare value of >= to get_posts(). i.e.
 {{{
 [meta_compare] = >=
 }}}
 '''Unexpected result:''' WordPress 4.0

 the array field value passed to get_posts() becomes
 {{{
 [meta_compare] => ’>=’
 }}}
 This problem is caused by wptexturize(), which converts a double quote to
 ” or a single quote to ’

 Pragmatic workaround:
 {{{
  remove_filter( "the_content", "wptexturize" );
 }}}

 Alternatively, I could introduce a specific test on the meta_compare
 parameter value and strip unexpected entities.
 I may have to do this anyway since I've seen a situation where the visual
 editor  has converted > to > which has caused a similar failure.

--

--
Ticket URL: <https://core.trac.wordpress.org/ticket/29608#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list