0

Can someone please explain how to read the letters, numbers, and colons in the wordpress database?

For example:

a:1:{s:13:"administrator";b:1;}

in the wp-capabilities table.

Thanks!

2

Those are php serialized constructs. The one you have there is an array. If you are looking to read them as a human, it breaks down like this:

Array: a:size:{key definition;value definition;(repeated per element)}
String: s:size:value

There are other possibilities that you can read more about here.

Generally, you should never modify these directly since unless you do it perfectly you will break the record. To manipulate them with php you'd unserialize(), manipulate, and then reserialize(). e.g.

//get $my_serialized_variable from database
$value = unserialize($my_serialized_variable);
$value[] = $element_i_want_to_add;
$serial = serialize($value);
//write serial to database

If you absolutely have to modify it in the database, use a tool like this to make sure you have a valid serial.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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