Deleting all pending WordPress comments

If you are like me, and your blogs puts all comments with one link or more in the Pending approval / Moderation queue, and you have over On Hundred Thousand (Not an exaggerated number) comments where at least 99.9% of them are spam, then you need to delete all pending comments without looking at them (Unless you plan to spend the rest of your days looking for that innocent commenter that probably wanted to say hi).

So, i want to do it the simplest way possible..

I want to execute some SQL through PHPMyAdmin that is given to me by my web host, and get all the comments gone

1- Get my Database username and password from wp-config.php
2- Login with the username and password at PHPMyAdmin
3- Chose the Db from the left, Hit the SQL tab from the top, then if your tables start with wp_ (Some may have changed that at install time)
4- DELETE FROM wp_comments WHERE comment_approved = 0;

WordPress updates

The wordpress team distributes WordPress updates very often, the process is very simple, you unzip, FTP (upload) the update, and you are done.

I do this very often for many many websites, although the process is simple, it is time consuming, the reson is that on shared hosting, i can not upload a zip file, i have to upload 800+ files for every single website, the latency of uploading 800 * 10 files adds up, and i should not need to do this

the task look as simple as, create a system to upload the new version to all FTP destinations every time there is a new wordpress update.

This is also more secure than allowing wordpress to update itself, wordpress code files should not be writable to the web server, only to the FTP user.

Anyway, i will get to this project soon (Maybe it will take 10 hours work), and once done i will keep you posted on how to add your FTP details.

Till then, happy wordpressing

Older wordpress installations get SEO Hacked

Versions before 3.1 got hacked where only google sees a big bulk of text with plenty of text, this is so that the visitor does not get a sense of urgency into fixing the issue.

Surely, by the time the user updates the compromised WP install, Search engines would have visited his/her website a few times, and think the links are important, giving away the beloved rank to the spammer !

In any case, it seems WordPress are aware of the issue, and the update, followed by the DB update (You will see when you login as admin) resolves the issue !

Happy blogging !

Working with RTL languages in WordPress

I have been trying to mix RTL (right to left) languages (Arabic, Hebrew, Urdu, Persian) with LTR (Left to right) languages (English, french, Latin, Spanish, Portuguese) on the same line in WordPress, but for some reason, the order of the phrases got messed up on both the editor ( tinyMCE ) and on the website

What i have found out from this website Here

What is displayed on the website can be fixed by editing the body tag in the theme and adding the dir=”rtl” tag, as for the editing, we need to fix the editor which is what i will explain how to do in this article.

Also from the site above, i have found that a magical line can be added to a file in WordPress and things will all work well, i am translating the article here for you (Since i do not know any Javascript, i am adding very little of my own). i will also put all the information there here since someone can derive solutions from this.

In TinyMCE, the solution is to add a statement to the configuration file, and therefore

tinyMCE.init({
        ...
        directionality : "rtl"
});

But this config is modified in WordPress, A JAVA variable is used to hold all the configs (tinyMCEPreInit.mceInit) So that the wordpress developer can add directives for TinyMCE from almost anywhere as needed, we have to add a variable to make the editor RTL by default.

Open the file

wp-admin/includes/post.php

And scroll down to the bottom where you fill find

tinyMCE.init(tinyMCEPreInit.mceInit);

And adding a line right before the line above we end up with

tinyMCEPreInit.mceInit.directionality = "rtl";
tinyMCE.init(tinyMCEPreInit.mceInit);

Now, refresh the POST page with a SHIFT+Refresh to get a fresh copy of the TinyMCE editor, and your editor should be RTL by default.

WordPress hacked on GoDaddy and NetworkSolutions

On September 17th and 18th, people with wordpress blogs on GoDaddy, NetSol, and others (I am sure about the 2 mentioned above) got hacked.

On network solutions, the virus (virtual-ad.org) added a php.ini file that instructed apache to execute the nts files as PHP, the php.ini file is in the directory cgi-bin, you can delete it, then you can delete the nts files at your convinience.

The automated solution i found online was

$ find ./ -name "*.php" -type f |   xargs sed -i 's###g' 2>&1$ find ./ -name "*.php" -type f |    xargs sed -i '/./,$!d' 2>&1

The problem with the above is that it is a bash script,and when that website offered a PHP file, the file used backticks to execute that same command, which will not work on any and every host.

In any case, the best solution is to

1- Backup your database

2- Delete all files except for wp-config

3- Get the latest WordPress and upload it instead

NOTE The virus we are talking about here added the lines

http://www.indesignstudioinfo.com/ls.php

http://zettapetta.com/js.php

to wordpress pages