When a user is logged in, the application stack is calling \MySLP_Contact_Us::initialize on every page load on the MySLP SaaS system. This should only be loaded when a user is interacting with the Contact Us page in the app.

This is being called via \MySLP_loader in the myslp-dashboard code. This happens when plugins_loaded action hooks are called from WordPress per this code block:

	// Load the Customer Profile module AFTER history logger (pri; 15)
	add_action( 'plugins_loaded', function () {
		/**
		 * @return void
		 */
		function myslp_customer_interfaces_loader(): void {
			require_once( MYSLP_PLUGIN_DIR . 'include/customer_profile/MySLP_Customer_Profile.php' );
			require_once( MYSLP_PLUGIN_DIR . 'include/MySLP_Contact_Us.php' );
			require_once( MYSLP_PLUGIN_DIR . 'include/MySLP_Customer_Maintenance.php' );

			MySLP_Contact_Us::get_instance();
		}

		myslp_customer_interfaces_loader();
	}, 15 );

Resolution

From Codex (ChatGPT):

I verified the Contact Us menu is effectively driven by MySLP_Contact_Us, and the global load happens in MySLP_loader. I’m now patching to stop loading it on plugins_loaded, register the menu in the main admin menu builder, and lazy-load MySLP_Contact_Us in the Contact Us page renderer.

I’ve moved menu registration and page rendering into MySLP::create_menu() and added a lazy render method with the exact require_once/get_instance logic. I’m making one small cleanup so MySLP_Contact_Us no longer self-registers the admin menu, preventing duplicate menu registration.

Notes

The same thing was happening for the “My Profile” page linked to MySLP_Customer_Profile classes. It was reworked to only load that class not the My Profile page.

Related MySLP Dashboard Repo Updates

c4bf6bb0cdd35d99f635d1c6faf03d9731aae969
ae8634c9bec325270225c2bfb156ec25504c7701
a081b1211e4486255d2022a1a990b6e63b1ab4cd
c9f20e2a81121a0db002a21a3351eb72044e693a
5f6375230df86880f60ccc65c585722d7c9e70d4
c67f7a6ed98871c0127d0699e33d08c7c97620ed
9bba966c3d86e70c525190422c87d64de56389e4
02392c5a2f80ead8a824285c8faa0efc9d0769fc
93c16c6447d4ae624724db133b8bffb28c36f4ea

Leave a Reply