Bug on product update (if product sync is on)
-
The bug is mentioned several times on github.
Description: When you click on editing a product -> /wp-admin/post.php?post=21&action=edit -> wp loads the product details with values from a different product.
It occurs if you have a shortcode in the product description, and product sync is turned on in the plugin settings.
Shortcodes in Flatsome use WP_Query to query f.ex. products and set the global in the loop with ->the_post(), and this function https://github.com/woocommerce/facebook-for-woocommerce/blob/master/includes/fbutils.php#L167-L168
executes shortcodes in the admin area (on the description, excerpt, title), making the global post not to be reset.That essentially means that any shortcode that uses a query and set the global post with the loop in their shortcode will have this issue, not only Flatsome. As wp_reset_query or wp_reset_postdata does not work as expected in the admin.
Please review the comments and a possible solution suggested by the flatsome dev team here: https://github.com/woocommerce/facebook-for-woocommerce/issues/2145
FfW will execute the shortcode in the backend (admin) when editing the product, which is the issue in itself as the last product in the loop of that shortcode on there is going to be set as post data (because of the WP bug that the original post is not been reset in the admin by doing that)
The best way to fix this is FfW having reset the original post after it has executed the shortcodes.
Thank you!
- The topic ‘Bug on product update (if product sync is on)’ is closed to new replies.