Support » Plugin: WP Gallery Download Links » Parse error: syntax error, unexpected ‘[‘

  • Resolved Andrews32

    (@andrews32)


    The plugin was not activated because it caused a fatal error:

    Parse error: syntax error, unexpected ‘[‘ in /home/u/user/site.com/public_html/wp-content/plugins/wp-gallery-download-link/wp-gallery-download-links.php on line 201

Viewing 4 replies - 1 through 4 (of 4 total)
  • The 201 line is:
    $url = wp_get_attachment_image_src( $id, ‘full’ )[0]; // returns an array

    Updated to WP 4.8, but the problem is still actual.

    The solution is:
    change
    $url = wp_get_attachment_image_src( $id, 'full' )[0]; // returns an array
    to
    $url = wp_get_attachment_image_src( $id, 'full' ); // returns an array
    and change
    $output .= "<dt class='gallery-download'><a href='{$url}' download=''>Download</a></dt>";
    to
    $output .= "<dt class='gallery-download'><a href='{$url[0]}' download=''>Download</a></dt>";

    Not it works!

    Plugin Author Michel Kusters

    (@michelkusters)

    I`m glad you were able to fix the issue, Andrew. I’ll look into it soon and update the plugin. Thank you!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Parse error: syntax error, unexpected ‘[‘’ is closed to new replies.