How to put Periods and Spaces for Array Values (Meta Key)

You may have build your meta box wrong: If your custom field names are not valid variable names PHP will convert all characters not matching [a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff] to underscores. The reason: register_globals. A request field must be able to work as a variable.

There are two workarounds:

  1. Name the field like an array: <input name="foo[TrackNumber mp3.Artist]">. Then just parse foo to get the value. That’s what WordPress does with the custom field box.

  2. Search for TrackNumber_mp3_Artist and convert the value before you save it to the database.