- This topic has 1 reply, 2 voices, and was last updated 7 years, 11 months ago by
Marcus.
Viewing 1 reply thread
-
AuthorPosts
-
-
February 20, 2014 at 8:08 pm #1434
ingridMemberWarning: array_keys() expects parameter 1 to be array, string given in /Users/user/website/example.com/wp-content/plugins/piklist/includes/class-piklist.php on line 731 Warning: Invalid argument supplied for foreach() in /Users/user/website/example.com/wp-content/plugins/piklist/includes/class-piklist.php on line 244I am getting these warnings on a page where I am displaying the output of a nested add more.
These warnings are being shown because of these two lines:
$brown_description = get_post_meta($post->ID, 'brown_description', true); piklist('addmore-box-template', array('data' => $brown_description, 'loop' => 'data'));Why is this code causing warnings?
Especially given that this code (below) does not cause any errors!
$box = get_post_meta($post->ID, 'box_content', true); piklist('addmore-box-template', array('data' => $box, 'loop' => 'data'));Does it have anything to do with the fact that
$brown_descriptionis inside the$boxarray?Thanks!
-
February 21, 2014 at 4:07 am #1436
MarcusMemberI’m just guessing but your piklist function is expecting $box and $brown_description to be arrays.
Yet in your get_post_metas, you are not loading them as arrays but as singles. (adding ‘, true’ to any get_post_meta request makes it a single not an array, default is ‘get_post_meta(id, meta_key, single=false’)Just a guess from looking at your code.
Marcus
-
-
AuthorPosts
Viewing 1 reply thread
- You must be logged in to reply to this topic.