Title: constant PHP error
Last modified: March 10, 2026

---

# constant PHP error

 *  Resolved [clayj](https://wordpress.org/support/users/clayj/)
 * (@clayj)
 * [1 month ago](https://wordpress.org/support/topic/constant-php-error/)
 * I’m getting the following error consistently:
 * PHP Fatal error: Uncaught Error: Call to a member function get_attributes() on
   null in /nas/content/live/wse/wp-content/plugins/code-snippets/php/snippet-ops.
   php(663) : eval()’d code:5#012Stack trace:#012#0 /nas/content/live/wse/wp-includes/
   class-wp-hook.php(341): ts_add_text_short_descr(‘<p>The Paint-Yo…’)#012#1 /nas/
   content/live/wse/wp-includes/plugin.php(205): WP_Hook->apply_filters(‘<p>The 
   Paint-Yo…’, Array)#012#2 /nas/content/live/wse/wp-content/plugins/woocommerce/
   includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php(
   842): apply_filters(‘woocommerce_sho…’, ‘The Paint-Your-…’)#012#3 /nas/content/
   live/wse/wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/
   class-wc-rest-products-controller.php(2045): WC_REST_Products_V2_Controller->
   get_product_data(Object(WC_Product_Simple), ‘view’, Object(WP_REST_Request))#
   012#4 /nas/content/live/wse/wp-content/plugins/woocommerce/includes/rest-api/
   Controllers/Version2/class-wc-rest-products-v2-controller.php(296): WC_REST_Products_Controller-
   >get_product_data(Object(WC_Product_Simple), ‘view’, Object(WP_REST_Request))#
   012#5 /nas/content/live/wse/wp-content/plugins/woocommerce/includes/rest-api/
   Controllers/Version3/class-wc-rest-products-controller.php(2138): WC_REST_Products_V2_Controller-
   >prepare_object_for_response_core(Object(WC_Product_Simple), Object(WP_REST_Request),‘
   view’)#012#6 /nas/content/live/wse/wp-content/plugins/woocommerce/includes/rest-
   api/Controllers/Version2/class-wc-rest-products-v2-controller.php(268): WC_REST_Products_Controller-
   >prepare_object_for_response_core(Object(WC_Product_Simple), Object(WP_REST_Request),‘
   view’)#012#7 /nas/content/live/wse/wp-content/plugins/woocommerce/includes/rest-
   api/Controllers/Version3/class-wc-rest-crud-controller.php(406): WC_REST_Products_V2_Controller-
   >prepare_object_for_response(Object(WC_Product_Simple), Object(WP_REST_Request))#
   012#8 [internal function]: WC_REST_CRUD_Controller->get_items(Object(WP_REST_Request))#
   012#9 /nas/content/live/wse/wp-content/plugins/woocommerce/src/Internal/Traits/
   RestApiCache.php(201): call_user_func(Array, Object(WP_REST_Request))#012#10 /
   nas/content/live/wse/wp-includes/rest-api/class-wp-rest-server.php(1292): WC_REST_Products_V2_Controller-
   >Automattic\WooCommerce\Internal\Traits\{closure}(Object(WP_REST_Request))#012#
   11 /nas/content/live/wse/wp-includes/rest-api/class-wp-rest-server.php(1125):
   WP_REST_Server->respond_to_request(Object(WP_REST_Request), ‘/wc/v3/products’,
   Array, NULL)#012#12 /nas/content/live/wse/wp-includes/rest-api/class-wp-rest-
   server.php(439): WP_REST_Server->dispatch(Object(WP_REST_Request))#012#13 /nas/
   content/live/wse/wp-includes/rest-api.php(467): WP_REST_Server->serve_request(‘/
   wc/v3/products’)#012#14 /nas/content/live/wse/wp-includes/class-wp-hook.php(341):
   rest_api_loaded(Object(WP))#012#15 /nas/content/live/wse/wp-includes/class-wp-
   hook.php(365): WP_Hook->apply_filters(NULL, Array)#012#16 /nas/content/live/wse/
   wp-includes/plugin.php(570): WP_Hook->do_action(Array)#012#17 /nas/content/live/
   wse/wp-includes/class-wp.php(418): do_action_ref_array(‘parse_request’, Array)#
   012#18 /nas/content/live/wse/wp-includes/class-wp.php(821): WP->parse_request(”)#
   012#19 /nas/content/live/wse/wp-includes/functions.php(1343): WP->main(”)#012#
   20 /nas/content/live/wse/wp-blog-header.php(16): wp()#012#21 /nas/content/live/
   wse/index.php(17): require(‘/nas/content/li…’)#012#22 {main}#012 thrown in /nas/
   content/live/wse/wp-content/plugins/code-snippets/php/snippet-ops.php(663) : 
   eval()’d code on line 5

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Contributor [Carolina](https://wordpress.org/support/users/carolinaop/)
 * (@carolinaop)
 * [1 month ago](https://wordpress.org/support/topic/constant-php-error/#post-18847367)
 * Hello [@clayj](https://wordpress.org/support/users/clayj/)
 * Thanks for reaching out, and I’m sorry to hear that you are facing issues on 
   your website. From the stack trace, the important part is this: `Call to a member
   function get_attributes() on null` and especially this part: `eval()’d code on
   line 5`
 * That indicates the fatal error is coming from the PHP code inside one of your
   snippets, rather than from the Code Snippets plugin itself. In this case, it 
   looks like the snippet function `ts_add_text_short_descr()` is trying to call`
   get_attributes()` on an object that is `null`, which usually means the expected
   object is not available at that point.
 * You will need to fix the code in that snippet so that it does not attempt to 
   call `get_attributes()` on a null value.
 * If the error prevents you from accessing the snippet editor in your dashboard,
   you can use our Safe Mode feature to temporarily disable snippets and regain 
   access to the admin area. You can find instructions here: [https://codesnippets.pro/doc/safe-mode/](https://codesnippets.pro/doc/safe-mode/)
 * Let us know if this helps.
 *  Plugin Contributor [Carolina](https://wordpress.org/support/users/carolinaop/)
 * (@carolinaop)
 * [2 weeks, 4 days ago](https://wordpress.org/support/topic/constant-php-error/#post-18863424)
 * Hello [@clayj](https://wordpress.org/support/users/clayj/)
 * As we haven’t heard back, I’ll proceed with closing this ticket for now. If you
   need any further assistance, please feel free to reopen it at any time—we’ll 
   be glad to help ☺️

Viewing 2 replies - 1 through 2 (of 2 total)

You must be [logged in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fconstant-php-error%2F%3Foutput_format%3Dmd&locale=en_US)
to reply to this topic.

 * ![](https://ps.w.org/code-snippets/assets/icon.svg?rev=2148878)
 * [Code Snippets](https://wordpress.org/plugins/code-snippets/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/code-snippets/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/code-snippets/)
 * [Active Topics](https://wordpress.org/support/plugin/code-snippets/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/code-snippets/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/code-snippets/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Carolina](https://wordpress.org/support/users/carolinaop/)
 * Last activity: [2 weeks, 4 days ago](https://wordpress.org/support/topic/constant-php-error/#post-18863424)
 * Status: resolved