Title: get_current_screen() called outside admin context causing fatal error on API
Last modified: May 14, 2026

---

# get_current_screen() called outside admin context causing fatal error on API

 *  [Jorion Tech](https://wordpress.org/support/users/jorionng/)
 * (@jorionng)
 * [3 weeks, 4 days ago](https://wordpress.org/support/topic/get_current_screen-called-outside-admin-context-causing-fatal-error-on-api/)
 *     ```wp-block-code
       Hi,We're experiencing a fatal error caused by the payment-forms-for-paystack plugincalling get_current_screen() in class-forms-update.php at line 602 via thesave_post hook.This function only exists in the wp-admin context. When WordPress REST APIrequests trigger save_post (e.g. creating or updating posts programmatically),get_current_screen() is unavailable, causing an uncaught fatal error that crashesthe entire site.Full error:Uncaught Error: Call to undefined functionpaystack\payment_forms\get_current_screen() in/wp-content/plugins/payment-forms-for-paystack/includes/classes/class-forms-update.php:602The fix is straightforward — wrap the get_current_screen() call with a contextcheck:if (!function_exists('get_current_screen') || !is_admin()) {return;}$screen = get_current_screen();This prevents the function from running outside wp-admin while preserving allexisting functionality within the admin interface.Could you please apply this fix in the next plugin update? As a temporaryworkaround we have added a custom plugin that removes the save_post hook duringREST API requests, but this causes post previews to break.WordPress version: latestPlugin version: current (no updates available)Thank you.
       ```
   

You must be [logged in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fget_current_screen-called-outside-admin-context-causing-fatal-error-on-api%2F%3Foutput_format%3Dmd&locale=en_US)
to reply to this topic.

 * ![](https://ps.w.org/payment-forms-for-paystack/assets/icon-256x256.png?rev=3047685)
 * [Payment Forms for Paystack](https://wordpress.org/plugins/payment-forms-for-paystack/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/payment-forms-for-paystack/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/payment-forms-for-paystack/)
 * [Active Topics](https://wordpress.org/support/plugin/payment-forms-for-paystack/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/payment-forms-for-paystack/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/payment-forms-for-paystack/reviews/)

## Tags

 * [api](https://wordpress.org/support/topic-tag/api/)

 * 0 replies
 * 1 participant
 * Last reply from: [Jorion Tech](https://wordpress.org/support/users/jorionng/)
 * Last activity: [3 weeks, 4 days ago](https://wordpress.org/support/topic/get_current_screen-called-outside-admin-context-causing-fatal-error-on-api/)
 * Status: not resolved