Support » Plugin: Pods - Custom Content Types and Fields » search field ignoring special characters

  • Resolved slingtaman

    (@slingtaman)


    Hi, i’m looking for a way to ignore quotes in pod title when searching.
    for example: a post has the following title:
    are you ‘cool’ today?
    i would like users who type:
    are you cool today? OR even: are you cool today
    to get the post in the results. in pure sql in is possible like so:
    where REPLACE(post_title, “‘” ,”) like “%are you cool today%”
    buti get an error when i use such syntax in pod’s where clause:
    ‘where’ = ” REPLACE(t.post_title, \”‘\” ,”) LIKE ‘%are you cool today%’ “;
    OR
    ‘where’ = ” REPLACE(t.post_title, ”’ ,”) LIKE ‘%are you cool today%’ “;

    Thanks and have a nice day

Viewing 2 replies - 1 through 2 (of 2 total)
  • ‘where’ = ” REPLACE(t.post_title, \”‘\” ,”) LIKE ‘%are you cool today%’ “;
    should be
    ‘where’ => ” REPLACE(t.post_title, \”‘\” ,”) LIKE ‘%are you cool today%’ “;
    of course, the typo was only here, not in actual code..

    Plugin Author Jim True

    (@jimtrue)

    You wouldn’t be able to do this in a shortcode because the escaping of the quotes in a where="..."is getting lost in the WordPress editor.

    You’d have to do this in PHP so you can properly escape those \" and \' or use a search plugin like Relevanssi that would strip out the quotes naturally.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘search field ignoring special characters’ is closed to new replies.