Redirecting logged in user from wp-login.php to home page

Just drop this in your functions.php:

Adding a button to TinyMCE – the Visual Editor in WordPress

I needed a simple button that would generate a shortcode on clicking. And that button had to be in the visual editor when adding or editing posts. That editor is implemented by TinyMCE, which is an opensource project too. Well, anyway, I wasted several hours fighting with existing plugins and themes that have introduced some custom buttons. I tried the Codex too, but that gave help for adding a custom style list only. Which was not the thing I needed.

Anyway, solution is almost simple. And I found it works about a day after I already implemented it. Theoretically speaking, it’s introducing a new “plugin” to TinyMCE.

What happens in practice is the following:

We add this code in the functions.php of your theme OR in a new plugin, just to have it across all themes we might go through.
Here comes the JavaScript file:
UPDATE: Watch out for the ‘ and ” when coping the code from here. You’ll have to replace them with real ones, as these may lead to an js error.

Simple Booking Form

Формуляр за резервации като за хотел (по дати), където в дадена страница просто се слага shortcode и от формуляра се пращат писма до админът и попълнилия формата.

WordPress optimization like a boss


Scanning our logs on your account further, it seems that the majority of the usage is coming from your WordPress installation. We suggest that you optimize the software to run as efficiently as possible to use the least amount of resources. Since you are using WordPress, I suggest visiting these following URLs for more information on how to optimize your WordPress installation:


Some general tips for optimizing WordPress are as follows:

1. Optimize the database. Often times, a database will become fragmented or bloated. You can use the “Optimize” function in PhpMyAdmin to optimize your tables. This will help reduce overhead on the database and increase performance.

2. Uninstall/disable any unnecessary plugins on the site. The more plugins you have enabled, the more resources a WordPress site will use. Also, some plugins do not play well together, or are simply poorly optimized and use more resources than they should.

3. Installing a caching plugin. There are several options for this such as, WP Super Cache, W3 Total Cache, Hyper Cache Extended, DB Cache Cache Reloaded, and so on. Caching reduces how often the same files need to be accessed, and caching queries can reduce how much your site needs to query the database. All of these, especially the database caching, can help to lower your resource usage on the server.

4. Sometimes the theme itself on a site can cause the resource usage to increase. If you are using a 3rd party theme, you may wish to see if there are any updates for it. If your theme is custom, then perhaps make sure it’s as optimized as it can be.

5. Install one or both of the following plugins in order to help identify the most resource intensive plugins installed under your site, as well as gaining the ability to control WordPress cron jobs since many performance issues with WordPress are a result of constant execution of the wp-cron.php script.

Once WordPress has been optimized, your site should be running much more efficiently and you should being using less system resources. Please let us know if you have any questions.

WordPress Security like a boss

Hello Vladimir,

Thanks for your cooperation. As far as I see, the folder with an outdated WP installation is removed from your account and all WP installations are up to date. So I’m going to mark this issue as resolved. However, I believe, WP security steps below can help you in future:

WP Security steps:

1. I advise you to apply chmod 600 permissions for the wp-config.php file. So that should protect that file from reading. As you know, you can do it via the FTP/SSH or using the “File Manager” web-application which is available for you from your account control panel.

2. I advise you to scan all computers you’ve accessed your account from for malicious software. Your passwords could be stolen by some virus/trojan malware.

3. Scan your network for malware as well.

4. Once you are sure that your computers aren’t infected please force password resets for all your accounts. You should reset the FTP accounts password as well as mysql users password. Be sure to use strong passwords like: Q_3{[+u.[7)2@#M
I believe, following online tool will help you to generate such passwords:

5. Please try to avoid accessing your web-site private areas from the public networks and be sure that your WiFi connection is secure.

6. Change the Default Admin Username to your own username.

7. Limit Admin access. You do that with help of the “Password Protect Directories” feature which is available from your account control panel.

8. Install CAPTCHA plugins which will protect forms on your web-site as well as login screens.

9. Remove all scripts/plugins/themes which were obtained from the non-trusted sources. Such plugins could be already infected, contain backdoor code or they could be poorly codded and due to this could be easily hacked.

10. Remove all old plugins/themes which aren’t in use or aren’t supported anymore.

There are many other steps you can take to protect your WP installation. I believe, following links will help you in future:

This ticket will automatically close after a few days of inactivity. You also have the option of closing it via your Backstage -> Support -> List Tickets section.

Please, don’t hesitate to contact us if we can be of any assistance or if you have any questions.

MySQL server has gone away (error #2006)

I had to migrate a web site from one server to another, having phpMyAdmin as the db administration tool and the db dump from the old server. Problems I faced were trivial, yet I wasted plenty of time on fixing them.

  • File is bigger than the limit for uploaded files. – Thats easy, if you got access to the configuration file for your PHP installation: php.ini. Just edit the value of the variable upload_max_filesize = 10M. Value should be a bit above your file’s size.

So far, so good, I did that and after restarting the web server (apache or IIS) you get in your phpMyAdmin the new limit next to the upload button. Well, that’s fine, but after I tried to upload my (obviously) small 2Mb archive of the dump, I got to the following error message:

#2006 – MySQL server has gone away

Damn! Quite a lot of people did not have a clue what to do with that. Someone said something about max_allowed_packet variable… so I checked it out (SQL query):

select @@max_allowed_packet

Size of that was 1048576, which was a bit smaller than my dump, bot compressed or in plain sql. What I did was changing it to something bigger. Like adding a 0 at the end:

set global max_allowed_packet=10485760

And that fixed my problem. After the import I returned the old value to 1048576.

“Language is already enabled or invalid!” when enabling new language to qTranslate

The error from the title pops-up when you enable a language you added a minute ago to the configuration (from the Settings -> Languages page). Usual case is you deal with an old database, that has collations, different from utf-8, and that messes up things. qTranslate FAQ will suggest you use a plugin called UTF Database Converter, but that one was last updated about two years ago the last time. And wiped out my content. That’s why I got a back-up 😉

What you’d better do (if you got WordPress 3.x) is get this one

It seems like an updated version of the previous one. The thing is that it does the business – just click a single button and it generates in several minutes a report on the results of the conversion. Do I need to say, that next thing is you check you’re website for issues with the content and plugins?

In the end you can go on with your qTranslate settings – add again the language of your choice and enable it. This time it’ll work like a charm!