WordPress Automatic Posting SQL Errors

I’ve been having problems with automatic posting on WordPress 1.5.2!

My new Clickbank News service requires automatic posting to work with this WordPress site. I was getting SQL errors that prevented posts from being applied.

I did a bit of research, and I found out that the problem was caused by apostrophes not being escaped. They should be preceded by a backslash before being submitted to the MySQL database.

The problem was easy to fix. To replicate my fix, look for the line that begins:

$post_data = compact('post_content' ...

Add the following two lines before it:

$post_content = addslashes($post_content);
$post_title = addslashes($post_title);

If you prefer, you can download my modified version here, but you need to add the hyphen back into the filename when you’ve finished downloading it:

Replacement wp-mail.php

David Thomas, The Affiliate Marketer

2 Responses

  1. Miles
    2006/03/16 at 00:46 | | Reply

    You should really upgrade to 2.0, they are actually at 2.0.2 now and there are many vunerablities and other upgrades and fixes.

    [Reply]

  2. admin
    2006/03/16 at 01:14 | | Reply

    Miles, it is on my list of things to do! :-)

    [Reply]

Leave a Reply

 

Spam Protection by WP-SpamFree

Powered by eShop v.6