Support » Fixing WordPress » Help with incorrectly-written code

  • Hello,
    I have no coding skills and I found a piece of code I was looking for. Only problem is that it is not written correctly. I just need someone to correct this one line as the code does work when this line is removed.

    The code in question:
    $output = preg_match_all("/caption=['"](.*)/", $content, $matches);

    The error message when executed:
    Parse error: syntax error, unexpected ']'

    Thanks for all the help,
    Gregory S.

Viewing 1 replies (of 1 total)
  • I think what you need is a slash before the double-quote preceding the closing bracket, like this:

    $output = preg_match_all("/caption=['\"](.*)/", $content, $matches);
Viewing 1 replies (of 1 total)
  • The topic ‘Help with incorrectly-written code’ is closed to new replies.