Skip to content

Fatal error when saving a post with WooCommerce [shop_messages] shortcode #8101

@langhenet

Description

@langhenet
  • [X ] I've read and understood the contribution guidelines.
  • [ X] I've searched for any related issues and avoided creating a duplicate issue.

Problem

When I try to add the [woocommerce_messages] or [shop_messages] shortcodes in a post or page while Yoast SEO is active, I get a fatal error upon saving the post/page.

Fatal error: Uncaught Error: Call to undefined function wc_print_notices() in J:\MAMP\htdocs\langhe\wp-content\plugins\woocommerce\includes\class-wc-shortcodes.php:578 Stack trace: #0 J:\MAMP\htdocs\langhe\wp-includes\shortcodes.php(345): WC_Shortcodes::shop_messages('', '', 'woocommerce_mes...') #1 [internal function]: do_shortcode_tag(Array) #2 J:\MAMP\htdocs\langhe\wp-includes\shortcodes.php(223): preg_replace_callback('/\\[(\\[?)(woocom...', 'do_shortcode_ta...', '[woocommerce_me...') #3 J:\MAMP\htdocs\langhe\wp-includes\class-wp-hook.php(298): do_shortcode('[woocommerce_me...') #4 J:\MAMP\htdocs\langhe\wp-includes\plugin.php(203): WP_Hook->apply_filters('[woocommerce_me...', Array) #5 J:\MAMP\htdocs\langhe\wp-content\plugins\wordpress-seo\admin\links\class-link-watcher.php(45): apply_filters('the_content', '[woocommerce_me...') #6 J:\MAMP\htdocs\langhe\wp-includes\class-wp-hook.php(300): WPSEO_Link_Watcher->save_post(65459, Object(WP_Post)) #7 J:\MAMP\htdocs\langhe\wp-includes\class-wp-hook.php(323): WP_Hook->apply_f in J:\MAMP\htdocs\langhe\wp-content\plugins\woocommerce\includes\class-wc-shortcodes.php on line 578

What I Expected

I expected the page/post to be saved normally :-)

How can we reproduce this behavior?

  1. install and Activate WooCommerce
  2. Install and Activate Yoast SEO
  3. Create a new page/post
  4. Insert the [shop_messages] or the alias [woocommerce_messages]
  5. Save the post/page

Technical info

  • WordPress version: 4.8.2
  • Yoast SEO version: 5.6.1
  • Relevant plugins in case of a bug: WC 3.2.X / 3.1.X

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions