Title: PHP Error &#8211; causes critical error on backend
Last modified: April 2, 2021

---

# PHP Error – causes critical error on backend

 *  [inspired888](https://wordpress.org/support/users/inspired888/)
 * (@inspired888)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/php-error-causes-critical-error-on-backend/)
 * Since a recent update, your otherwise excellent plug-in appears to be causing
   critical errors on our site.
 * As of last few days, when we do certain changes in Plug-ins on WP, the site gets
   a critical error.
 * In the PHP logs the only error I see each time it happens is this one:
 * `[Fri Apr 02 00:25:05.426787 2021] [php7:error] [pid 4675] [client 127.0.0.1:
   12728] PHP Fatal error: Uncaught Error: Call to undefined method Automattic\\
   WooCommerce\\Admin\\Notes\\WC_Admin_Note::set_layout() in /nas/content/live/mckays/
   wp-content/plugins/woo-advanced-shipment-tracking/includes/class-wc-admin-notices.
   php:76\nStack trace:\n#0 /nas/content/live/mckays/wp-includes/class-wp-hook.php(
   287): WC_AST_Admin_Notices_Under_WC_Admin->admin_notices_for_ast_pro('')\n#1 /
   nas/content/live/mckays/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters(
   NULL, Array)\n#2 /nas/content/live/mckays/wp-includes/plugin.php(484): WP_Hook-
   >do_action(Array)\n#3 /nas/content/live/mckays/wp-settings.php(557): do_action('
   init')\n#4 /nas/content/live/mckays/wp-config.php(126): require_once('/nas/content/
   li...')\n#5 /nas/content/live/mckays/wp-load.php(37): require_once('/nas/content/
   li...')\n#6 /nas/content/live/mckays/wp-cron.php(44): require_once('/nas/content/
   li...')\n#7 {main}\n thrown in /nas/content/live/mckays/wp-content/plugins/woo-
   advanced-shipment-tracking/includes/class-wc-admin-notices.php on line 76`
 * Do you have any suggestions?
 * Thank you,
 * Jonathan
    -  This topic was modified 5 years, 1 month ago by [inspired888](https://wordpress.org/support/users/inspired888/).

Viewing 1 replies (of 1 total)

 *  Thread Starter [inspired888](https://wordpress.org/support/users/inspired888/)
 * (@inspired888)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/php-error-causes-critical-error-on-backend/#post-14266914)
 * It appears to be related to the plug-in trying to display an admin notice. And
   that is causing an error. The code in question is this:
 *     ```
       // Otherwise, add the note
       		$activated_time = current_time( 'timestamp', 0 );
       		$activated_time_formatted = date( 'F jS', $activated_time );
       		$note = new Automattic\WooCommerce\Admin\Notes\WC_Admin_Note();
       		$note->set_title( 'Advanced Shipment Tracking PRO' );
       		$note->set_content( 'We just released the Advanced Shipment Tracking Pro! Upgrade now and enjoy a 20% off early bird discount. To redeem your discount, use coupon code ASTPRO20 (valid until March 31st)' );
       		$note->set_content_data( (object) array(
       			'getting_started'     => true,
       			'activated'           => $activated_time,
       			'activated_formatted' => $activated_time_formatted,
       		) );
       		$note->set_type( 'info' );
       		$note->set_layout('plain');
       		$note->set_image('');
       		$note->set_name( $note_name );
       		$note->set_source( 'AST Pro' );
       		$note->set_layout('plain');
       		$note->set_image('');
       ```
   
 * Specifically this line, `$note->set_layout('plain');`
 * When I comment out the $note related code from your plug-in, I stop getting the
   critical errors that were occurring in wp-admin (mostly occurred when I activated/
   deactivated plug-ins, etc.). I will leave it commented out for now.
    -  This reply was modified 5 years, 1 month ago by [inspired888](https://wordpress.org/support/users/inspired888/).
    -  This reply was modified 5 years, 1 month ago by [inspired888](https://wordpress.org/support/users/inspired888/).

Viewing 1 replies (of 1 total)

The topic ‘PHP Error – causes critical error on backend’ is closed to new replies.

 * ![](https://ps.w.org/woo-advanced-shipment-tracking/assets/icon-256x256.png?rev
   =2166296)
 * [Advanced Shipment Tracking for WooCommerce](https://wordpress.org/plugins/woo-advanced-shipment-tracking/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woo-advanced-shipment-tracking/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woo-advanced-shipment-tracking/)
 * [Active Topics](https://wordpress.org/support/plugin/woo-advanced-shipment-tracking/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woo-advanced-shipment-tracking/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woo-advanced-shipment-tracking/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [inspired888](https://wordpress.org/support/users/inspired888/)
 * Last activity: [5 years, 1 month ago](https://wordpress.org/support/topic/php-error-causes-critical-error-on-backend/#post-14266914)
 * Status: not resolved