Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

i have installed wordpress and i i have installed couple of plugins and i have got two themes already came with wordpress.

What i am asking about today is : what does the Plugins & Theme string value in database mean ?

Example [When plugins are active] , there is a value on table of :

a:3:{i:0;s:19:"akismet/akismet.php";i:1;s:9:"hello.php";i:2;s:37:"one-click-logout/one-click-logout.php";}

Example [When there are themes on the Themes folder] , there is a value on table of :

a:2:{s:12:"twentyeleven";s:7:"/themes";s:9:"twentyten";s:7:"/themes";}

I could get an explanation of what does the "a" and "i" mean from HERE , but the "s:" is what i do not know what does it mean. If i tried to change the s:37 to s:6 or any other value , the plugin becomes deactivated , so the s:37 <<< the 37 must mean something or related to the plugin somehow and that`s what i am trying to find out.

share|improve this question

3 Answers 3

up vote 2 down vote accepted

The value is a serialized php array. Further explanation is not really WordPress specific, but here you go -- the 's' is the length of the string representation of the succeeding array element (the length of the string in quotes). I.E. in

a:2:{s:12:"twentyeleven";s:7:"/themes";s:9:"twentyten";s:7:"/themes";}

the "12" in s:12 represents the length of twentyeleven.

share|improve this answer
    
Thank you , that was informative and exactly what i wanted to know. –  R.Vector Jun 14 '12 at 22:11

These values are serialized. You should not be manually editing them.

EDIT:

To elaborate, you can manipulate these values through WordPress using the following functions (depending on whether they're stored as options or as post meta):

get_option() update_option() get_post_meta() update_post_meta()

share|improve this answer

These are serialized strings, or arrays/objects converted to a string to be stored in the database.

They will not recognize any changes you make to the string itself and will throw errors if you try to tamper with them. They are built in fashion to guarantee that the data that was there before serialization is exactly the same data that will return after you unserialize it.

To be able to change a value, you need to unserialize it first:

$string = 'a:2:{s:12:"twentyeleven";s:7:"/themes";s:9:"twentyten";s:7:"/themes";}';

$array = unserialize($string);

var_dump($array);

results in:

array(2) { ["twentyeleven"]=> string(7) "/themes" ["twentyten"]=> string(7) "/themes" } 
share|improve this answer

Your Answer

 
discard

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.