Skip Navigation

Using special characters in meta_keys (custom field names) breaks Views queries

Won't fix

Reported for: Toolset Views 2.6

Symptoms

Sometimes, you might want to use special characters in the meta_key of custom fields.

This is not possible with Toolset Types but is achievable using custom code or other plugins. However, we strongly advise against doing this.

Having such special values in the meta key of a custom field or any other meta key in general, can cause issues in queries used in Toolset Views.

Workaround

There are two possible solutions here:

  1. Don’t use special characters in meta_keys. This is not explicitly forbidden in WordPress but is also not recommended.
  2. If you really need to use special characters in meta_keys for certain custom fields then don’t use those fields in any Toolset queries.

 

The following special characters are the major cause of these issues (even if escaped properly on PHP level):

  • `
  • %
  • $ (if used at the beginning of a key)

Our developers are aware of this issue but we decided not to address it because it is not recommended anyway – you should always use valid characters for meta keys.

Leave
a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>