0

I am writing a wordpress plugin
The problem is this plugin effecting website performance.
I need tips to make my plugin faster, any help would be amazing.
My plugin contains several classes and I am including all of them in the main php file also using mostly "init" for my actions.

$inc_path = ABSPATH . 'wp-content/plugins/doctor-profile/';
require_once $inc_path . 'includes/helpers.php';

include_once $inc_path . 'plugin-template.php';
include_once $inc_path . 'includes/installer.php';
include_once $inc_path . 'includes/shortcodes.php';
include_once $inc_path . 'includes/options.php';
include_once $inc_path . 'includes/registration.php';
include_once $inc_path . "includes/login.php";
include_once $inc_path . 'includes/upload.php';
include_once $inc_path . "includes/editprofile.php";

$helper = new SalamatiInstaller();
$editProfile = new SalamatiEditProfile();
$shortCodes = new SalamatiShortCodes();
$options = new SalamatiOptions();
$login = new SalamatiLogin();
$registration = new SalamatiRegistration();

//

When the plugin is enabled the website load time is 9 second and when the plugin is deactivated the website load time is 5 second.
this is how I am including my classes.
Any Tips Anything regardless of my code would be amazing thanks.

  • you can load the classes on demand with this : php.net/autoload – mmm Oct 18 '16 at 15:59
  • Showing this code doesn't give any clue as to what could be happening. – stims Oct 18 '16 at 17:50
  • Also, why are you loading them from a file in your root wordpress directory, this somewhat foreshadows how the code is implemented into wordpress as a whole, but again, we would need more context (code) to deduce that. – stims Oct 18 '16 at 17:54
  • I have got a lots of codes. There must be some methods faster than the others for example using init action is different than using after_setup_theme performance wise and other stuff. The kind of coding method that experience proves that it is faster than other methods. sort of general performance coding advice. thanks – MMT designer Oct 19 '16 at 5:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.