Support » Plugin: Anti-spam » Only load on single blog post pages?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author webvitalii


    loads its javascript file on all pages instead of just the blog posts

    I did not managed to load file only on posts and pages. I had some problem with that and I left javascript everywhere.
    IMHO it is not a big problem because file loads only once and other time browser will use the cached file. By the way js-file is very small – about half of the kilobyte.

    Javascript file enqueued in the right way – using wp_enqueue_script().
    And also Anti-spam plugin uses jquery from the core how WordPress core developers recomend to do it.

    Sorry, but I don’t know how to solve your task without hacking the Anti-spam core.

    webvitaly, thanks for following up. I think I’ve figured out a way to remove anti-spam.js from loading on non-post pages. I wanted to run it by you:

    if (!is_single()) {
        remove_action('init', 'antispam_scripts_styles_init');

    I put the above in my functions.php and it seems to do the trick. I know the anti-spam.js is very small, but I’d prefer to remove from pages where it’s not used in order to remove the unnecessary header request to anti-spam.js.

    I am thinking of replacing my Spam Free WordPress with Anti-Spam … nothing wrong with it, but it may no longer be free next time.

    I would use BWP-Minify to load this js in the footer and see if it will work. And use Plugin Organizer (the plugin I think everyone should have before anything) to load it only in posts I want it to.

    Plugin Author webvitalii


    @astrasuite: Anti-spam plugin will always be free.
    And I will support it as long as I can.
    I cannot use word “forever” here because it’s impossible 🙂
    Blocking spam should be free, easy and invisible – it’s the main idea of Anti-spam plugin.

    But even if something will happen you can switch anytime to variety of other free anti-spam plugins. It is open source and users always have options to choose…

    Thanks, Vitaly, will try it out. I agree with you, it should be free.

    I saw your update about cache, so it’s just in time for me, as I cannot have a WordPress site without caching.

    I was modifying Search Google to open the search results in a new tab (target=”_blank”) and I just realized it’s also a plugin by you. Been using it for a long time, the best 🙂

    Ok, just installed, perfect, tested and no problems, even with W3 Total Cache. I then loaded the javascript into the footer using Better WordPress Minify, and still perfect.

    Now to wait if I see any spam that comes in the next few days/weeks …

    Vitaly, I was inspecting the code using Firebug and saw this :

    <span style=”display:inline;”>ye@r</span>

    Is this normal, the year spelled as “ye@r” ?


    Plugin Author webvitalii


    @astrasuite: I’m glad you love “Search by Google” plugin. I hope you will love Anti-spam plugin too. I love them and use all of them 🙂 But if you will have some troubles – I will try to help.

    All plugins, which I made – I made for myself to solve some tasks which I have at the moment. But I think it would be pretty stupid not to share them with everyone.
    Now there are half of the million downloads and I think it is awesome 🙂

    About “ye@r”: this was made intentionally just for not being “year” in case if anti-spam bots will try to parse and analyze it. There are many logical traps in the plugin and it is one of them. It is not paranoia-mode or fun-word-mode, it was made with a reason.
    The word “ye@r” will see only users, who have disabled javascript and who want to submit a comment. But still them can recognize word “ye@r” as a “year”.
    While making and supporting Anti-spam plugin I learn a lot about spam.
    And one thing I can tell for sure – the modern spam is fully automated, clever and evolving pretty fast. Only non-standard complex but simple approach can solve spam problem.

    I was pretty surprised to stop all spam with 150 lines of code 🙂
    Alternatives have thousands lines of code with same efficiency.

    Thanks, Vitaly ! Keep up the great work 🙂

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Only load on single blog post pages?’ is closed to new replies.