• Checking our site performance looking for bottlenecks we have realized that we are experiencing a delay of 200ms in every request when initializing the plugin due to these lines in the WC_Referralcandy_Integration::init_form_fields() method:

    
    $published_pages = get_pages(['status' => ['publish']]);
    $tracking_page_options = [];
    foreach ($published_pages as $page) {
        $tracking_page_options[$page->post_name] = $page->post_title;
    }
    

    This variable is only used to fill the list of available options in the plugin settings. Could you calculate and fill it only when showing the settings page?
    Alternately, could you cache this list in a transient, so it’s only calculated once in a while?

    Thank you!

  • The topic ‘Slowness when initializing plugin if the site has lots of posts’ is closed to new replies.