0

I've noticed that in my plugin code there is something wrong. I'm getting an illegal string offset error in the dependency delcaration of the wp_register_script function

                wp_register_script(
                    'map-autocomplete',
                    'https://cdn.jsdelivr.net/gh/tomickigrzegorz/autocomplete@1.8.3/dist/js/autocomplete.min.js',
                    ['map','map-config'],
                    false,
                    true
                );
                wp_enqueue_script('map-autocomplete');

Is there something wrong into the array?

6
  • I don’t see anything obviously wrong. Are you sure this is the relevant code? What’s the full error? Mar 10 at 13:34
  • The error that is displayed is Illegal string offset 'map' but the code is ok, not sure why this occur, it's a warning, not really an error
    – ICTDEV
    Mar 10 at 14:19
  • 1
    Are you running an extremely old PHP version? Mar 10 at 14:23
  • I'm on local dev machine, on php 7.4
    – ICTDEV
    Mar 13 at 8:13
  • Well the error doesn’t make any sense. Either this isn’t the actual code in use or it’s not the code that’s throwing the error because I can’t see anything in this code that would throw that error. Mar 13 at 9:11

0

Your Answer

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

Browse other questions tagged or ask your own question.