Type file is no longer stored as array in db
-
On a site with Piklist 0.9.9.13 I had a block on homapage with image as a background, kept in a file field. Here is it’s definition:
array( 'type' => 'file', 'field' => 'block_background_image', 'label' => __( 'Background image', 'textdomain' ), 'help' => __( 'The image to use as a background. Make sure it\'s smallest side is 800px. If no image is set, the Humanitas green color will be used as a fallback.', 'textdomain' ), 'columns' => 4 )
Checking the output of the block that I have defined, the image is stored as an array of file IDs, although it’s a single file. That’s cool, but when I upgraded to 0.9.9.15, this field is now treated as a single element in the array of post-meta for that block. My code, looking for ‘block_image'[0] now returns null. If I add two files in the editing of the page, only the second file is saved in the DB. I do believe this is related to some of the changes that were meant for PHP 7.2 compatibility, or you did not document a change in the way file field is treated.
- The topic ‘Type file is no longer stored as array in db’ is closed to new replies.