latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

s2member slowing site down

Home Forums Community Forum s2member slowing site down

This topic contains 3 replies, has 3 voices. Last updated by  Christian 3 years, 3 months ago.

Topic Author Topic
Posted: Thursday Sep 5th, 2013 at 7:19 am #59151
Username: hifidunn

pingdom tools says that s2member has a very long load time and so did my host.
Any way of improving this?
After the latest updates my site has become slower. I am not sure if there has been any changes.
I use wp super cache and wp minify.
I have read some of the other threads about this issue, but cannot see how to fix it.

List Of Topic Replies

Viewing 3 replies - 1 through 3 (of 3 total)
Author Replies
Author Replies
Posted: Thursday Sep 5th, 2013 at 10:44 am #59157
Username: hifidunn

it is really bad how long it takes to load. More than 14 seconds and s2member is about 90% of that.

Posted: Thursday Sep 5th, 2013 at 5:36 pm #59167
Username: wellwater

You can just load the necessary s2member javascript/css files on the pages that need it, instead of site-wide.

Here are some pages that discuss the logic behind it:

If you only have a few pages that need the s2member code, such as your buy/checkout pages, you could get away with something like the following. Create a file called “s2-hacks.php” (or whatever you want) in your “/wp-content/mu-plugins/” folder, and save the following in it.

// Remove s2Member JavaScript and CSS files except for the pages below.
if ((strpos($_SERVER['REQUEST_URI'], '/checkout-page-1') === false) && (strpos($_SERVER['REQUEST_URI'], '/checkout-page-2') === false)) {
    // Remove CSS files.
    function remove_all_s2_css()
    add_action('ws_plugin__s2member_during_add_css', 'remove_all_s2_css');

    // Remove JavaScript files.
    function remove_all_s2_js()
    add_action('ws_plugin__s2member_during_add_js_w_globals', 'remove_all_s2_js');

The code above is saying, if a user is viewing “/checkout-page-1” or “/checkout-page-2” then load s2member’s CSS and JavaScript. Otherwise, don’t load it. If you have many checkout pages located in a directory, such as “/checkout/product-1/”, “/checkout-product-2/”, then you can just swap out “/checkout-page-1” with “/checkout” and it’ll protect everything within your directory.

It’s a pretty hacky way to accomplish the goal, but it gets the job done.

By the way, even on pages where s2member is loading, it should be possible to get an excellent pingdom score if you’re covering all other bases: gzipping content, using CDN for static content, setting expiry headers, efficiently loading JavaScript, minifying CSS/JS.

  • This reply was modified 3 years, 4 months ago by  TJ.
Posted: Sunday Sep 15th, 2013 at 4:50 pm #59594
Username: ilanddk

Hi there,

Is there some documentation on what actually happends the moment you remove .css and .js files?

What specific functionality is depending on these elements to load?

Thanks :)


Viewing 3 replies - 1 through 3 (of 3 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.