AJAX Not Working For WP-Email, WP-Polls, WP-PostRatings or WP-PostViews?

About 2 weeks ago, I release an update to r WP-Email, WP-Polls, WP-PostRatings and WP-PostViews which added some nonce check and moved the AJAX request to be handled by /wp-admin/admin-ajax.php.

3 common issues that users are facing.

“-1” or “Failed To Verify Referrer”
This means that most likely you are using a caching plugin like W3 Total Cache (W3TC) and the Javascript being minified/combined and cached is outdated. Just empty the JS/CSS cache under the “Minify” section of W3TC in WP-Admin and W3TC will regenerate it again. This will solve the problem.

Password Protected /wp-admin/ Will Not Work
If you are using .htpasswd to protect your /wp-admin/ folder, AJAX request to /wp-admin/admin-ajax.php will not work. This problem is not unique to my plugin. Any WordPress Plugins that uses the WordPress AJAX API will break. As mentioned in this Codex, Hardening WordPress:

Simply securing the wp-admin/ directory might also break some WordPress functionality, such as the AJAX handler at wp-admin/admin-ajax.php

To bypass this, check out this tutorial, Password protecting the wp-admin directory, this tutorial will teach you how to whitelist admin-ajax.php in your /wp-admin/ using .htaccess.

I still hope in the future version of WordPress, they will separate front facing AJAX requests vs backend AJAX requests.

Your WP-Admin Is HTTPS While Your Site Is Not
If your WP-Admin is behind SSL aka HTTPS and you have the following config in your wp-config.php define('FORCE_SSL_ADMIN', true);, the AJAX will fail because https://yoursite.com is different from http://yoursite.com and the browser treat it as different domain.

To solve this issue do the following:
Find:
'ajax_url' => admin_url('admin-ajax.php'),
Replace:
'ajax_url' => admin_url('admin-ajax.php', (is_ssl() ? 'https' : 'http')),

What the code does is basically forcing http to be used when calling admin-ajax.php for AJAX request. Again this is a hack, I am trying to figure a way around it.

I have pushed the code to trunk of all the respective plugins.

1 Star2 Stars3 Stars4 Stars5 Stars (411 votes, average: 4.16 out of 5)

WP-Polls, WP-PostRatings, WP-PostViews, WP-Email Updated

I have updated the following plugins:

Now all AJAX requests are handled by /wp-admin/admin-ajax.php. Previously it is handled via the plugin PHP file itself by assuming that wp-load.php is always 2 levels down from the plugin file. But since you can have your WordPress in any folders, custom loading of wp-load.php is not possible as the path to wp-load.php varies from server to server.

While I am at it, I added nonce check for AJAX calls to WP-Polls, WP-PostRatings and WP-Email. Let me know if you run into problems via WordPress Support Forums, My Forums (if you are already registered) or via email (lesterchan AT gmail).

PS: Kindly refer to https://lesterchan.net/wordpress/2012/06/05/ajax-not-working-for-wp-email-wp-polls-wp-postratings-or-wp-postviews/ if you ran into problems.

1 Star2 Stars3 Stars4 Stars5 Stars (136 votes, average: 3.97 out of 5)

Lester Chan’s WordPress Plugins June 2009 Update

Here is my June 2009 WordPress plugins update containing all my 16 WordPress plugins update. All of them should work on WordPress 2.8 as I did not test them on any WordPress version below that.

Now my plugins uses jQuery for AJAX instead of TW-Sack. I have also updated the widget code to make use of the new WordPress 2.8 new Widget class and that supports multi-instances widgets. The widget code has now been merge with the main plugin file so the standalone widget plugin file is no longer in use. Please delete the whole plugin folder and upload it again to avoid any error.

As WordPress 2.8 supports loading of JavaScript in the footer, all my plugins’ JavaScripts will be loaded in the footer. Be sure you have in your theme footer.php.

Be sure to read the readme.html and checkout the changelog for more information and most importantly NOTE THE TABS AT THE TOP

WP-Ban 1.50
» Readme/Changelog
» Download Mirror #1
» Support Forum

WP-CommentNavi 1.10
» Readme/Changelog
» Demo
» Download Mirror #1
» Support Forum

WP-DBManager 2.50
» Readme/Changelog
» Download Mirror #1
» Support Forum

WP-DownloadManager 1.50
» Readme/Changelog
» Demo
» Download Mirror #1
» Support Forum

WP-EMail 2.50
» Readme/Changelog
» Demo
» Download Mirror #1
» Support Forum

WP-PageNavi 2.50
» Readme/Changelog
» Demo
» Download Mirror #1
» Support Forum

WP-PluginsUsed 1.50
» Readme/Changelog
» Demo
» Download Mirror #1
» Support Forum

WP-Polls 2.50
» Readme/Changelog
» Demo
» Download Mirror #1
» Support Forum

WP-PostRatings 1.50
» Readme/Changelog
» Demo
» Download Mirror #1
» Support Forum

WP-PostViews 1.50
» Readme/Changelog
» Demo
» Download Mirror #1
» Support Forum

WP-Print 2.50
» Readme/Changelog
» Demo
» Download Mirror #1
» Support Forum

WP-RelativeDate 1.50
» Readme/Changelog
» Demo
» Download Mirror #1
» Support Forum

WP-ServerInfo 1.50
» Readme/Changelog
» Download Mirror #1
» Support Forum

WP-Stats 2.50
» Readme/Changelog
» Demo
» Download Mirror #1
» Support Forum

WP-Sticky 1.50
» Readme/Changelog
» Demo
» Download Mirror #1
» Support Forum

WP-Useronline 2.50
» Readme/Changelog
» Demo
» Download Mirror #1
» Support Forum

If you like or love my plugins a lot, do consider making a donation to me. My Paypal email address is lesterchan AT gmail DOT com. Thank you =D

1 Star2 Stars3 Stars4 Stars5 Stars (301 votes, average: 4.01 out of 5)

Lester Chan’s WordPress Plugins December 2008 Update

Here is my December 2008 WordPress plugins update containing all my 15 WordPress plugins update and 1 new WordPress plugin. All of them should work on WordPress 2.7 as I did not test them on any WordPress version below that.

I am introducing a new plugin called WP-CommentNavi which basically paginate your comments similar to how WP-PageNavi paginate your posts. I am also retiring WP-Sticky as WordPress 2.7 has a sticky post feature built in. WP-Sticky 2.31 WILL NOT work on WordPress 2.7 due to a conflict function “is_sticky”. If you renamed that function to “is_sticky2” or something else, it should work, but as usual I did not test it.

*UPDATE* Due to the large number of requests, I decided not to retire WP-Sticky and I have updated it to 1.40 and it is now compatible with WordPress 2.7.

Be sure to read the readme.html and checkout the changelog for more information and most importantly NOTE THE TABS AT THE TOP

WP-Ban 1.40
» Readme/Changelog
» Download Mirror #1
» Download Mirror #2
» Support Forum

WP-CommentNavi 1.00
» Readme/Changelog
» Demo
» Download Mirror #1
» Download Mirror #2
» Support Forum

WP-DBManager 2.40
» Readme/Changelog
» Download Mirror #1
» Download Mirror #2
» Support Forum

WP-DownloadManager 1.40
» Readme/Changelog
» Demo
» Download Mirror #1
» Download Mirror #2
» Support Forum

WP-EMail 2.40
» Readme/Changelog
» Demo
» Download Mirror #1
» Download Mirror #2
» Support Forum

WP-PageNavi 2.40
» Readme/Changelog
» Demo
» Download Mirror #1
» Download Mirror #2
» Support Forum

WP-PluginsUsed 1.40
» Readme/Changelog
» Demo
» Download Mirror #1
» Download Mirror #2
» Support Forum

WP-Polls 2.40
» Readme/Changelog
» Demo
» Download Mirror #1
» Download Mirror #2
» Support Forum

WP-PostRatings 1.40
» Readme/Changelog
» Demo
» Download Mirror #1
» Download Mirror #2
» Support Forum

WP-PostViews 1.40
» Readme/Changelog
» Demo
» Download Mirror #1
» Download Mirror #2
» Support Forum

WP-Print 2.40
» Readme/Changelog
» Demo
» Download Mirror #1
» Download Mirror #2
» Support Forum

WP-RelativeDate 1.40
» Readme/Changelog
» Demo
» Download Mirror #1
» Download Mirror #2
» Support Forum

WP-ServerInfo 1.40
» Readme/Changelog
» Download Mirror #1
» Download Mirror #2
» Support Forum

WP-Stats 2.40
» Readme/Changelog
» Demo
» Download Mirror #1
» Download Mirror #2
» Support Forum

WP-Sticky 1.40
» Readme/Changelog
» Demo
» Download Mirror #1
» Download Mirror #2
» Support Forum

WP-Useronline 2.40
» Readme/Changelog
» Demo
» Download Mirror #1
» Download Mirror #2
» Support Forum

If you like or love my plugins a lot, do consider making a donation to me. My Paypal email address is lesterchan AT gmail DOT com. Thank you =D

1 Star2 Stars3 Stars4 Stars5 Stars (71 votes, average: 3.94 out of 5)