Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

image field warning #138

Open
ah-polash opened this issue Nov 6, 2016 · 1 comment
Open

image field warning #138

ah-polash opened this issue Nov 6, 2016 · 1 comment

Comments

@ah-polash
Copy link

ah-polash commented Nov 6, 2016

Hello
Thank you for the nice script.
When i am trying to retrieve the url of a image or a PDF file i am getting a warning like below.
Warning: Illegal string offset 'url' in C:\xampp\htdocs\development..............................................fileName.php

i have used below code to retrieve the url of the image.
$saved_data = get_post_meta($post->ID,'image_field_id',true); echo '<img src="'.$saved_data['url'].'">';

@iamveecee
Copy link

iamveecee commented Jun 28, 2019

Replace the code following code on line 703 and 716 in meta-box-class/my-meta-box-class.php file

At line 703
$std = isset($field['std'])? $field['std'] : array('id' => '', 'url' => '');
with
$std = (isset($field['std']) && !empty($field['std']))? $field['std'] : array('id' => '', 'url' => '');

At line 716
$value = isset($meta['id']) ? $meta : $std;
With
$value = (isset($meta['id']) && !empty($meta) )? $meta : $std;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants