Home Forums Newsletter Plugin Support Newsletter plugin slowing down wp-admin

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #342967
    bengrubb
    Participant

    Hi there!

    I have been using the free version of The Newsletter Plugin for about a year now and have today been cleaning up my WordPress admin back-end, as it’s been quite slow.

    Using the Query Monitory plugin, I discovered that The Newsletter Plugin performs a licence and plugin check on every single load of any wp-admin page. Not just its own plugin pages.

    All in all, it’s taking up 1.2 seconds of load time.

    It loads this URL in 0.8 seconds
    https://www.thenewsletterplugin.com/wp-content/plugins/file-commerce-pro/get-license-data.php

    And it loads this URL in 0.5 seconds:
    http://www.thenewsletterplugin.com/wp-content/extensions.json
    ?ver=8.7.7

    Is this expected behaviour? Can I do anything to improve the load time? I wrote some code to see what would happen if I disabled both of those URLs loading and it sped up wp-admin pages, but of course The Newsletter Plugin did not like this lol. I could try to write some code that disables it on every admin page except for the plugin’s but I’ll probably break something agian.

    Any ideas? And is is really necessary to have those URLs load on every wp-admin page? Is this something The Newsletter Plugin could change in a future update?

    #342968
    bengrubb
    Participant

    For what’s it’s worth, the below code successfully blocked the calls to those URLs outside of the The Newsletter Plugin pages in wp-admin, thereby increasing their load time.

    Initially it caused the plugin to throw up messages about the licence check failing, but I think this may have been because of a conflict WP Code snippet I had enabled. Waiting to see what happens.

    add_filter( ‘pre_http_request’, function( $pre, $args, $url ) {
    if ( ! is_admin() ) return $pre;

    // Allow if we’re on the newsletter plugin’s main admin page
    if ( isset($_GET[‘page’]) && $_GET[‘page’] === ‘newsletter_main_index’ ) {
    return $pre;
    }

    // Block external requests to thenewsletterplugin.com elsewhere in wp-admin
    if ( strpos( $url, ‘thenewsletterplugin.com’ ) !== false ) {
    return new WP_Error( ‘request_blocked’, ‘Blocked external request to thenewsletterplugin.com’ );
    }

    return $pre;
    }, 10, 3 );

    #342969
    bengrubb
    Participant

    I updated the code to the following after accounting for different URL variables (as I was getting more licence issues on other The Newsletter Plugin pages:

    add_filter( ‘pre_http_request’, ‘gsn_allow_newsletter_plugin_requests’, 10, 3 );

    function gsn_allow_newsletter_plugin_requests( $pre, $args, $url ) {
    if ( ! is_admin() ) {
    return $pre;
    }

    // Allow all admin pages related to The Newsletter Plugin
    if ( isset($_GET[‘page’]) && strpos($_GET[‘page’], ‘newsletter_’) === 0 ) {
    return $pre;
    }

    // Block specific external domains (e.g. Newsletter license checks elsewhere)
    if ( strpos( $url, ‘thenewsletterplugin.com’ ) !== false ) {
    return new WP_Error( ‘request_blocked’, ‘Blocked external request to thenewsletterplugin.com’ );
    }

    return $pre;
    }


    so far so good

    #342972
    Stefano
    Keymaster

    Hi, thank you for reporting, it seems like a problem with the license checking it should cache the response (or the error condition), I’ll check the code carefully it could be is a bug.

    #342974
    Stefano
    Keymaster

    Hi, could it be on your site, the WP transients are not saved/kept?

    #342978
    bengrubb
    Participant

    I think you might be right. It would appear to be something to do with transients.

    I installed Transients Manager and the below is what I see. Some very old, expired transients are in there and no fresh ones (with my code from above disabled). Why this is happening I do not know. I do have a few plugins installed. I use Godaddy, which may be doing some persistent object caching?
    —-
    newsletter_topbar
    Edit | Delete
    a:3:{s:5:”count”;s:1:”0″;s:5:”total”;N;s:4:”sent”;N;}
    array
    2025-02-25 13:25:29
    Expired
    Select newsletter_user_count
    newsletter_user_count
    Edit | Delete
    244
    numeric
    2025-02-16 11:31:45
    Expired
    —-
    These are the plugins I currently have that are active:
    Sphere Core

    Sphere Post Views

    SSL Insecure Content Fixer

    Transients Manager

    Two Factor

    URL Shortify

    User Role Editor

    WP Control

    WP Mail SMTP

    WPCode Lite

    XML Sitemap & Google News

    Akismet Anti-Spam: Spam Protection

    Conditional Display Featured Image on Singular Posts and Pages

    Donorbox Donation Form

    Edit Author Slug

    Elementor

    Favicon by RealFaviconGenerator

    Health Check & Troubleshooting

    Limit Login Attempts Reloaded

    Molongui Authorship

    Newsletter

    Newsletter – Addons Manager and Support

    Newsletter – Instasend (BETA)

    Newsletter – SMTP2GO

    Performance Lab

    Query Monitor

    Redirecton

    Responsive Lightbox & Gallery

    Site Kit by Google

    SmartMag Core

    #342979
    Stefano
    Keymaster

    Uhm, since the WP transients create us many problems in the past, I’ll manage to convert the stored data from transients to standard options.
    Anyway, you can check if the wp_options table has problems, especially if it is a myISAM table.

    #342981
    bengrubb
    Participant

    Thank you!

    Unrelated to the issue at hand (I think), I did notice The Newsletter Plugin was requesting http rather than https on this URL: http://www.thenewsletterplugin.com/wp-content/extensions.json
    ?ver=8.7.7

    It does request https for get-license-data.php. Just thought I’d pass that on.

    I’ll continue looking at what might be playing up on my web server.

    Thanks again for your help.

    #342982
    Stefano
    Keymaster

    Usually we have a fallback from HTTPS to HTTP. Maybe that file is requested only with HTTP. Many hosting providers have wrong SSL certificates installed, the fallback helps in solving those problems.

    #342983
    bengrubb
    Participant

    I see re http/https.

    For what it’s worth, my wp_options table (named mdpm_options) is InnoDB and not myISAM.

    I am on a GoDaddy shared hosting account, not a managed WordPress account, so I am thinking persistent object caching maybe isn’t the cause. It’s probably something to do with GoDaddy though.

    #342987
    Stefano
    Keymaster

    Object caches are good candidates for creating problems with transients, but it’s hard to have a definitive answer. Usually, they completely get wrong caching missing values.

Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.