0

Just came accross while retriving wp_capabilities from wp_usermeta table, this returns serialize output a:1:{s:13:"administrator";b:1;}

When i unserialized, it gives an array

Array ( [administrator] => 1 )

Since I'll be querying in a foreach loop to prepare a custom user record list, need a way so that for each user i can echo the value administrator or whatever that belongs to particular user.

  • Use echo key( $user->caps ); – Frank P. Walentynowicz Jun 17 '15 at 13:58
  • This question is about basic PHP and is not really WordPress specific. How are you retrieving the data? Post your code, please. Perhaps that will bring the question on-topic. – s_ha_dum Jun 17 '15 at 14:19
  • @s_ha_dum you are correct!! Even I'm retrieving in a Laravel blade, but since the usermeta table is specific to wordpress, I thought wp ppl may respond quick. – echoashu Jun 17 '15 at 15:39
  • That just makes this further off topic as you will need a "blade" solution, and harder to debug/answer. – s_ha_dum Jun 17 '15 at 15:43

Your Answer

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

Browse other questions tagged or ask your own question.