• I had to disable the Page Restrict for WooCommerce plugin because of slow load times. All pages on the site took 30 seconds or more to initially load when the plugin was activated. Once deactivated they load at normal speeds. Are there known conflicts with specific themes (XStore) or any certain plugins?

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Vlado Grcic

    (@vladogrcic)

    There aren’t any conflicts I’m aware of. Have you tried switching to one of the default wp themes and/or disabling other plugins (except for woocommerce)? It might be slower on large websites. Does that happen in backend as well or just the front facing site? Or some pages? Also check debug.log. Not sure what else to suggest.

    Unfortunately, I confirm the problem.
    I have 1500 users in the database. When a guest vists the site, without logging in, it takes about 10 seconds to open each page. I have performed all the usual steps – changing the theme, disabling all plugins – to determine that the delay is caused by Page Restrict.
    I looked into the code. In class-user-restrict-data.php, in the purchased_products_by_user function, there is strangely handled a situation when the user is not logged in ($user_id is false). Instead of returning an empty array of purchased products, it examines all users and their products. As a result, the code evaluated once for the logged user executes 1500 times for a guest. I commented it out, it helped. I recomend to review this piece of code.

    Plugin Author Vlado Grcic

    (@vladogrcic)

    Thank you for your in depth investigation. I’ll check it out whenever I can and see what to do about this.

    Wiktor

    (@wiktorradecki)

    Hi, I’ve got the same problem, your plugin is really great but slows down the whole WP very much. PHP is 8.0.30, memory limit 512M, WP is 6.4.3 and Page Restrict for WooCommerce is 1.6.5. I’ve commented function from line 86 beginning with “private function purchased_products_by_user( $postID_products, $user_id=false ){” … but it crashed. Can you find the solution, please. Or maybe I’ve commented wrong function?

    Hi Victor,

    Just comment out lines 128-152 (line 128 contains “$users = …”, line 152 contains “}”, two lines before line 154 with “return $purchased_products_by_user”).

    Be aware that you have to do it again every time you’ll update Page Restrict plugin.

    Plugin Author Vlado Grcic

    (@vladogrcic)

    @wesleylindsey @mfigatow @wiktorradecki Sorry for the very long wait. I’ve restricted that part of the code to registered users, it seems to not load when not needed. Please try version 1.6.6 when you can and see if its working for you. @mfigatow thanks for the help, I’ll try and look over this again over the weekend to be sure.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Slow load times’ is closed to new replies.