WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a WP plugin, where all admin setting field values were suddenly changed to the letter 'a'. All settings are stored in one 'big' option in the table. Seemed like the serialization gone wrong.

I run a var_dump on the get_option value and it returned a truncated string, not an array as usual. I'll update the question once I can reproduce the truncated string again.

I only use the 'Save changes' button and let the WP Options API write to the option, getting the values from user changeable or hidden HTML fields.

Is there any special characters or similar that can prevent an option from being written properly which could result in the serialized array being truncated?

The cause has something to to with Instagram or an Instagram user name.

share|improve this question
Incompatible character encodings (ISO-8859-1 versus UTF-8) can result in truncated strings. But this happens usually in the first invalid byte, not as early as on the first letter. But check the encoding nevertheless. – toscho Jun 23 '13 at 9:57
Did you check what is written to database? Is there a correct value for this options fields or is it saved incorrectly? – Krzysiek Dróżdż Jun 23 '13 at 11:54
Then write an answer with all the details please. And mark your question as answered. – toscho Jun 23 '13 at 17:17
up vote 1 down vote accepted

It was a 👼 character. Make sure you sanitize everything that gets written as field values, even if it's a username.

trim(preg_replace("/[^\w\s]+/", "", $user->full_name))

I assumed there are no special characters in Instagram usernames. Never assume. I don't really use Instagram, just my plugin supports it. BTW it got truncated on the first occurrence of the special character.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.