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)

JavaScript In My Plugins II

I have completed the “update” process to my 5 of my plugins (WP-Polls, WP-PostRatings, WP-Email, WP-ServerInfo and WP-UserOnline) which use JavaScript.

  • WP-Polls and WP-PostRatings uses JavaScript on the frontend as well as the backend
  • WP-Email and WP-UserOnline uses JavaScript on the frontend only
  • WP-ServerInfo uses JavaScript on the backend only

Unfortunately the changes require at least WordPress 2.8 onwards to make use of the JavaScript enhancements in WordPress 2.8. I have updated this site to WordPress 2.8 Bleeding Edge aka WordPress 2.8 Nightly in order to test the JavaScript changes on a live site.

If you view the HTML source of this page, you will notice that only the CSS files get loaded in the header and the JavaScript gets loaded in the footer.

If you are running WordPress 2.8 bleeding edge, perhaps you can help me test out the plugins. Thanks in advanced 🙂

1 Star2 Stars3 Stars4 Stars5 Stars (177 votes, average: 4.15 out of 5)

WordPress 3.4

WordPress 3.4 has been released.

For Users

The biggest change in 3.4 is the theme customizer which allows you to play around with various looks and settings for your current theme or one you’re thinking about switching to without publishing those changes to the whole world. For themes that support it, you can change colors, backgrounds, and of course custom image headers. We have more planned for the customizer down the road.

Throughout the rest of the admin you’ll notice tweaks to make your everyday life easier. For example, if you have lots of themes we’ve made it quicker to browse them all at once without paging. We’ve made it possible to use images from your media library to populate custom headers, and for you to choose the height and width of your header images.

We’ve expanded our embed support to include tweets: just put a Twitter permalink on its own line in the post editor and we’ll turn it into a beautiful embedded Tweet. And finally, image captions have been improved to allow HTML, like links, in them.

For Developers

There are hundreds of under-the-hood improvements in this release, notably in the XML-RPC, themes, and custom header APIs, and significant performance improvements in WP_Query and the translation system. The Codex has a pretty good summary of the developer features, and you can always dive into Trac directly.

[wpvideo Gg0EFixV]

Download: WordPress 3.4

PS: My plugins should work with WordPress 3.4, if you discovered any bug, just drop me an email, lesterchan AT gmail.

1 Star2 Stars3 Stars4 Stars5 Stars (105 votes, average: 4.15 out of 5)

Development Version Of My Plugins

For those who want the latest development version of my plugins to go along with WordPress 2.3, do the following:

  1. Go to http://wordpress.org/extend/plugins/profile/GamerZ
  2. Choose the plugins you want
  3. Click “Other Versions” (If you can’t find this link, just click on “Download Plugin”)
  4. Scroll down to the “Other Versions” section
  5. Click on “Development Version”

The development version should be the final version that I will release unless some last minute bug comes out.

I intend to officially release the final version a few days after WordPress 2.3 goes out the door instead of along side with the release of WordPress 2.3.

1 Star2 Stars3 Stars4 Stars5 Stars (66 votes, average: 4.15 out of 5)

Gearing Up For WordPress 2.1

I have updated all my plugins readme and added a nice index page to the readme directory as you can see here: http://www.lesterchan.net/wordpress/readme/. All ready for the launch of WordPress 2.1. All my plugins are zipped and waiting to be uploaded and overwritten to the ftp directory.

But nevertheless I hope WordPress 2.1 will be launched on 1st February 2007, so that I can have enough time to update my print and email plugin. They DO WORK for WordPress 2.1, I just want to internationalize it so that they can be translated easily. All my plugins are now internationalize.

If have translated any of them, feel free to attach the .po and .mo file to me. I will then upload to the /i8n/ folder of the respective plugin of the CVS. Take WP-Polls i8n folder for example: http://dev.wp-plugins.org/browser/wp-polls/i18n

1 Star2 Stars3 Stars4 Stars5 Stars (39 votes, average: 4.15 out of 5)