WordPress with HyperDB on PHP 7.0

I was configuring WordPress with HyperDB plugin on PHP 7.0 but the only I get were constant 500 errors. As I found here PHP 7.0 is not supported by HyperDB for now - it’s rely on mysql php extension but in PHP 7.0 there is only mysqli extension. But few folks fixed it and it’s possible to use it. curl -O https://raw.githubusercontent.com/soulseekah/hyperdb-mysqli/master/db.php mv db.php /var/www/wordpress/wp-content/ And configure it ex. like this:...

2016-02-24 · 1 min

Install WordPress from command-line

I never tried it before but today I needed to install WordPress… From command line only. And there is a way to do this with wp-cli. WP-CLI installation First some requirements (as root): apt-get install php5-cli php5-mysql mysql-client curl And now installation of wp-cli (as root too): curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar chmod +x wp-cli.phar mv wp-cli.phar /usr/local/bin/wp Check if it’s working: $ wp --version WP-CLI 0.22.0 WordPress installation Now you should switch to user of your web application, ex....

2016-02-15 · 1 min

Mass replace in WordPress posts via MySQL query

I was doing a lot of changes to my old posts, switched to HTTPS, etc. Sometimes it was useful to change some particular text in all my old posts at a time, but there is no such feature in WordPress. But WordPress runs on MySQL and I could use SQL query to update such posts. Make backup - it’s not required but strongly advised 😃 Now use this query as template to replace in place whatever you need: ...

2016-02-09 · 1 min

fail2ban - block wp-login.php brute force attacks

Lately I had a lot of brute force attacks on my WordPress blog. I used basic auth to /wp-admin part in nginx configuration to block this and as a better solution I wan’t to block source IPs at all on firewall. To do this, place this filter code in /etc/fail2ban/filter.d/wp-login.conf: # WordPress brute force wp-login.php filter: # # Block IPs trying to authenticate in WordPress blog # # Matches e.g. # 178....

2015-12-31 · 1 min

WordPress - add meta tags: author, description, keywords, etc

After reading some SEO stuff I wanted to add some meta tags to my WordPress blog. I found this site: codex.wordpress.org/Meta_Tags_in_WordPress. So WordPress thinks that it’s not necessary to have this meta tags any more… But I want it! 😃 Next funny thing is how they suggest to add meta tags: copy header.php - what about theme updates? I prefer to use functions.php file - just create it in your courrent theme directory with such content:...

2014-03-27 · 1 min

Piwik: śledzenie asynchroniczne + logowanie ksywy komentującego w WordPress’ie

Korzystam z instancji Piwik’a do monitorowania odwiedzin na stronie i postanowiłem pokombinować czy da się w ten sposób monitorować wejścia konkretnych osób na bazie wpisanego w polu komentarza loginu/ksywki. Jak zacząłem grzebać to przy okazji zmieniłem też sposób ładowania skryptów Piwika na asynchroniczny. A leci to mniej więcej tak: <script type="text/javascript"> var i,x,y,ARRcookies=document.cookie.split(";"); var comment_author = ""; for (i=0;i<ARRcookies.length;i++) { x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("=")); y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1); x=x.replace(/^\s+|\s+$/g,""); if (x.indexOf("comment_author") != -1 && x.indexOf("comment_author_email") == -1 && x....

2012-12-21 · 1 min

Nginx - konfiguracja pod WordPress’a

To raczej nie jest podstawowy konfig i próżno szukać go na stronie WordPress’a, więc odradzam tę zabawę jeśli nie zna się zbyt dobrze nginx’a. Ponieważ serwerek, na którym działa stronka to sprzęcik z Atomem 330 i mocy na CPU zbyt wiele nie ma to popularne pluginy (np. W3 Total Cache) potencjalnie zwiększające wydajność tak na prawdę zmulały stronkę jeszcze bardziej. Pluginów sprawdziłem kilka i każdorazowo efekt był podobny - stronka działała wolniej niż bez ich pomocy....

2012-06-29 · 8 min