Error in php code on WP site

Asked

Viewed 26 times

-1

The wordpress site is presenting the following error message:

Parse error: syntax error, Unexpected ';', expecting ',' or ')' in /home1/mesabout/public_html/wp-content/plugins/facebook-for-Woocommerce/includes/Products.php on line 1180

I made some changes but did not solve.

Code:

    public static function get_enhanced_catalog_attributes_from_request() {
        $prefix     = Admin\Enhanced_Catalog_Attribute_Fields::FIELD_ENHANCED_CATALOG_ATTRIBUTE_PREFIX;
        $attributes = array_filter(
            $_POST,
            function( $key ) use ( $prefix ) {
                return substr( $key, 0, strlen( $prefix ) ) === $prefix;
            },
            ARRAY_FILTER_USE_KEY
        );

        return array_reduce(
            array_keys( $attributes ),
            function( $attrs, $attr_key ) use ( $prefix ) {
                return array_merge(
                    $attrs,
                    array(
                        str_replace( $prefix, '', $attr_key ) =>
                                                                wc_clean( Framework\SV_WC_Helper::get_posted_value( $attr_key ) ),
                    );
            },
            array(),
        );
    }

1 answer

0

Hello, I think you forgot to close the parenthesis of the mer_array function

return array_merge(
  $attrs,
  array(
      str_replace($prefix, '', $attr_key) => wc_clean(Framework\SV_WC_Helper::get_posted_value($attr_key)),
  )
); // <- AQUI

Browser other questions tagged

You are not signed in. Login or sign up in order to post.