Reputation
475
Top tag
Next privilege 500 Rep.
Access review queues
Badges
3 14
Newest
 Informed
Impact
~24k people reached

  • 0 posts edited
  • 0 helpful flags
  • 13 votes cast
1d
awarded  Informed
Apr
16
awarded  Necromancer
Mar
21
revised When moving a WP site, why does wp-admin redirect to old site?
Table name is incorrect. It's wp_options, not wp_posts.
Dec
4
awarded  Popular Question
May
9
awarded  Popular Question
Feb
11
awarded  Revival
Dec
3
comment Server side validation
I think the validation part is OK, but there is no real error handling, which is odd, as it is, indeed, something pretty basic. In other words, there is no elegant way to validate, post back errors and then pre-populate fields. Everyone is pretty much on their own on this one.
Aug
28
awarded  Yearling
Jul
30
awarded  Popular Question
Jul
23
comment When moving a WP site, why does wp-admin redirect to old site?
The GUID should not be changed. Read more here: codex.wordpress.org/Changing_The_Site_URL#Important_GUID_Note
Jul
22
answered When moving a WP site, why does wp-admin redirect to old site?
Jul
22
answered How can I reduce the number of database query calls for this custom homepage?
Jul
2
awarded  Curious
Jul
16
comment Version control with a team of non-developers
If you only version control half your project, you're not really reaping the benefits. My recommendation would be to not go down that road. If a user touches code, he or she checks it in.
Mar
28
awarded  Yearling
Mar
11
comment Contact information footer
Make sure you follow the specs: Max. 20 characters, can not contain capital letters or spaces codex.wordpress.org/Function_Reference/register_post_type
Mar
10
answered Contact information footer
Feb
11
comment How can I save repeatable fields with one value inside an array?
Yes in terms of $option_name. The serialized array you printed though, does not seem to contain the image ID, just the caption. I don't know what your specific needs are, but I would assume the array would look much like the array I posted above ($_POST['fields']) when stored in the database, in terms of structure i.e. array of image ID/caption pairs.
Feb
11
comment How can I save repeatable fields with one value inside an array?
$option_name could be a string like slides... it's just a key in the database to retrieve your options i.e. array of slides. In terms of Array, you're trying to print an array as a string, but it's an array. Whatever your variable is called that prints Array, try this: echo '<pre>' . print_r($your_variable, true) . '</pre>' and you'll see exactly what the array contains. Then you can grab the appropriate string via the index.
Feb
11
comment How can I save repeatable fields with one value inside an array?
Yes, you should replace fields with something more descriptive, such as slides, but I'd make it more unique in case someone or something else ever uses slides. $option_name would be any string, also as unique as possible, that you'd use to save/retrieve the contents of your array from the database. get_post_meta returns an array of custom fields (in case you have more than one) and unless you specify true as the third argument e.g. $slides = get_post_meta($post_id, $option_name, true), you'll have to supply the index e.g. $slides[0].