• Skip to main content
  • Skip to primary sidebar

Technical Notes Of
Ehi Kioya

Technical Notes Of Ehi Kioya

  • About
  • Contact
MENUMENU
  • Blog Home
  • AWS, Azure, Cloud
  • Backend (Server-Side)
  • Frontend (Client-Side)
  • SharePoint
  • Tools & Resources
    • CM/IN Ruler
    • URL Decoder
    • Text Hasher
    • Word Count
    • IP Lookup
  • Linux & Servers
  • Zero Code Tech
  • WordPress
  • Musings
  • More
    Categories
    • Cloud
    • Server-Side
    • Front-End
    • SharePoint
    • Tools
    • Linux
    • Zero Code
    • WordPress
    • Musings
Home » Frontend (Client-Side) » Auto-Check MailPoet “Subscribe In Comments” Box

Auto-Check MailPoet “Subscribe In Comments” Box

By Ehi Kioya 1 Comment

The MailPoet plugin comes with a “subscribe in comments” option that allows visitors who comment on a post to subscribe to your list via a checkbox. But the plugin leaves this box unchecked by default. And it offers no setting/option to have the box checked on page load (some other email plugins like MailChimp have this option but MailPoet doesn’t).

With this jQuery snippet, you can have the box auto-checked on page load:

<script>(function($){
    $(document).ready(function(){
        $('#mailpoet_subscribe_on_comment').prop('checked', true);
    });
})(window.jQuery);</script>

You can insert this code on your web pages using a custom code plugin like Head, Footer and Post Injections. Or if your theme comes with it’s own script injection feature, you could use that too.

Since WordPress loads jQuery by default, you don’t need to manually include the jQuery library. It just works.

Cool thing is… The above construct can be used for any checkbox that you want to have checked by default. If you can identify the element ID of the checkbox using your browser’s developer tools, you can then replace #mailpoet_subscribe_on_comment with your checkbox ID and it will stay checked by default on every page load.

Found this article valuable? Want to show your appreciation? Here are some options:

  1. Spread the word! Use these buttons to share this link on your favorite social media sites.
  2. Help me share this on . . .

    • Facebook
    • Twitter
    • LinkedIn
    • Reddit
    • Tumblr
    • Pinterest
    • Pocket
    • Telegram
    • WhatsApp
    • Skype
  3. Sign up to join my audience and receive email notifications when I publish new content.
  4. Contribute by adding a comment using the comments section below.
  5. Follow me on Twitter, LinkedIn, and Facebook.

Related

Filed Under: Frontend (Client-Side), JavaScript, Programming, Snippets, WordPress Tagged With: Email, MailPoet, Plugin, Snippet, WordPress

About Ehi Kioya

I am a Toronto-based Software Engineer. I run this website as part hobby and part business.

To share your thoughts or get help with any of my posts, please drop a comment at the appropriate link.

You can contact me using the form on this page. I'm also on Twitter, LinkedIn, and Facebook.

Reader Interactions

Comments

  1. Evan says

    September 9, 2020 at 1:54 pm

    For some reason, after I add this and I see it checked, it unchecks itself?

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

23,727
Followers
Follow
30,000
Connections
Connect
14,568
Page Fans
Like
  • Recently   Popular   Posts   &   Pages
  • Actual Size Online Ruler Actual Size Online Ruler
    I created this page to measure your screen resolution and produce an online ruler of actual size. It's powered with JavaScript and HTML5.
  • How To Install PHP Packages Without Composer How To Install PHP Packages Without Composer
    This article shows how to bypass the Composer barrier when installing Composer-dependent PHP packages. Great shortcut for PHP enthusiasts!
  • WordPress Password Hash Generator WordPress Password Hash Generator
    With this WordPress Password Hash Generator, you can convert a password to its hash, and then set a new password directly in the database.
  • About
  • Contact

© 2022   ·   Ehi Kioya   ·   All Rights Reserved
Privacy Policy