I am trying to make an acf repeater field with the link field. I don't understand why I get an error message: "Warning: ltrim() expects parameter 1 to be string, array given in"

Here is my code


    <?php if($assos):?>

    <?php foreach ($assos as $asso):
        $web = $asso ['title_fields_two'] ?>

            <a href="<?php echo esc_url($web);?>">
                <?php echo "$web";?>

    <?php endforeach; endif?>``
  • At a guess, I'd say that $web is not a string but an array. esc_url() uses ltrim() on the value you pass to it. You'll have to check with ACF support for more on this; third-party plugin support is off topic here.
    – Pat J
    Jan 9 at 17:50
  • 1
    ok i see thank you
    – Thica
    Jan 10 at 8:15


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy