Home › Forums › Bug Reports › Illegal string offset 'acf_fc_layout' on Flexible Content
I am using my own flexible content field and I filter it from another select field that is registered to an option page. The is basically a Global Blocks page. The fields are working great within the Admin panel and with in the front end of my website, but because of this I am getting this PHP Warning.
Illegal string offset 'acf_fc_layout' in /var/www/shopbedmart/public_html/wp-content/plugins/advanced-custom-fields-pro/pro/fields/class-acf-field-flexible-content.php on line 833
Looking at the file and code there is a condition after the variable to check if it exists and if not then continue:
class-acf-field-flexible-content.php on line 833
// get layout name
$l = $value[ $i ]['acf_fc_layout'];
// bail early if layout deosnt exist
if( empty($layouts[ $l ]) ) continue;
In order to get rid of the Warnings which are flooding my log file I think an additional condition should be placed before the $l variable.
Like
if (empty($value[ $i ]['acf_fc_layout'])) continue;
// get layout name
$l = $value[ $i ]['acf_fc_layout'];
// bail early if layout deosnt exist
if( empty($layouts[ $l ]) ) continue;
Thanks
@bmostrey Sorry, No.
I will add my condition above and it works, but I have to remember to add it back on each update.
This is not a bug that I have seen. Most of the time these errors are caused by how something else is being done. I would need more information, like more details on how you are constructing this flex field and template code being run when the error happens.
You can also try contacting the developer, but he’d need the same information to try to recreate the error. https://www.advancedcustomfields.com/contact/
@hube2 Thanks,
If I get time I will do that. Unfortunately, I am no longer on that project and a bit slammed right now, but I will keep it in mind.
@bmostrey Just curious were you experiencing the same issue.
If so, are you doing the same with Flexible fields that I am or something different.
Thanks
The topic ‘Illegal string offset 'acf_fc_layout' on Flexible Content’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.