Title: Memory allocation issue with some API requests when plugin is active
Last modified: December 29, 2025

---

# Memory allocation issue with some API requests when plugin is active

 *  [pshemek](https://wordpress.org/support/users/emmek/)
 * (@emmek)
 * [5 months, 2 weeks ago](https://wordpress.org/support/topic/memory-allocation-issue-with-some-api-requests-when-plugin-is-active/)
 * I have issues with memory limit on a server during some requests when your plugin
   is active. The problem is gone once I deactivate it.
   (It concerns some REST API
   and WPGraphQL API requests. I had allocated 1024M of memory and it wasn’t enough)
 * Analyze, please, even with help of LLM like Claude the plugin’s code and find
   and address its weak points. There is so many people using this plugin that any
   optimization can really make a world-wide impact.
 * For example:
 *     ```wp-block-code
       public function forbidden_slugs() {  $wp = new \WP;  return array_merge( $wp->public_query_vars, $wp->private_query_vars );}
       ```
   
 * **Problem**: Creates a new `WP` instance on every call. The `WP` class is a core
   WordPress object that can be heavy. This method is called during slug validation,
   potentially multiple times per request.
 *     ```wp-block-code
       $request = parse_url( rawurldecode( $_SERVER['REQUEST_URI'] ) );
       ```
   
 * **Problem**: This parsing happens multiple times in plugins_loaded() and wp_loaded()
   on **every request**. No caching mechanism exists.
 *     ```wp-block-code
       global $current_user;if ( ! is_user_logged_in() && is_wp_error( wp_authenticate_username_password( null, $current_user->user_login, $_POST['post_password'] ) ) ) {
       ```
   
 * **Problem**: Accesses `$current_user->user_login` when user is NOT logged in.
   This could cause undefined property access and potential memory allocation issues.
 * etc.

You must be [logged in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fmemory-allocation-issue-with-some-api-requests-when-plugin-is-active%2F%3Foutput_format%3Dmd&locale=en_US)
to reply to this topic.

 * ![](https://ps.w.org/wps-hide-login/assets/icon-256x256.png?rev=1820667)
 * [WPS Hide Login](https://wordpress.org/plugins/wps-hide-login/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wps-hide-login/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wps-hide-login/)
 * [Active Topics](https://wordpress.org/support/plugin/wps-hide-login/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wps-hide-login/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wps-hide-login/reviews/)

## Tags

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

 * 0 replies
 * 1 participant
 * Last reply from: [pshemek](https://wordpress.org/support/users/emmek/)
 * Last activity: [5 months, 2 weeks ago](https://wordpress.org/support/topic/memory-allocation-issue-with-some-api-requests-when-plugin-is-active/)
 * Status: not resolved