Jump to content

explain this array please


CyberShot

Recommended Posts

I am working with wordpress. I am coding some custom meta boxes following some code someone else had written. My code is working but I am not sure if I need to do it the way I am doing it. The person who wrote the code added the option like so

 

$custom = get_post_meta($post->ID);
$item_link = $custom["item_link"][0];

 

According to the wordpress codex, get_post_meta($post->ID) Returns a multidimensional array with all custom fields of a particular post or page.

so when I added a second option, I followed with this

 

$item_text = $custom["item_text"][0];

 

I guess my question would be..Do i need to add the index 0 to every option or should I increase it by 1 for every new option I add?

Link to comment
https://forums.phpfreaks.com/topic/245805-explain-this-array-please/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.