WordPress with HyperDB on PHP 7.0

I was configuring WordPress with HyperDB  external link plugin on PHP 7.0 but the only I get were constant 500 errors. As I found here  external link 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. ...

2016-02-24 · 1 min · timor

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  external link . 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: ...

2016-02-15 · 1 min · timor

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: UPDATE wp_posts SET post_content = REPLACE(post_content, " ", ""); You should see something like: ...

2016-02-09 · 1 min · timor

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.218.54.109 - - [31/Dec/2015:10:39:34 +0100] "POST /wp-login.php HTTP/1.1" 401 188 "-" "Mozilla/5.0 (Windows NT 6.0; rv:34.0) Gecko/20100101 Firefox/34.0" # [Definition] failregex = ^<HOST> .* "POST /wp-login.php ignoreregex = Then edit your /etc/fail2ban/jail.local and add: ...

2015-12-31 · 1 min · timor

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  external link . 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? ...

2014-03-27 · 1 min · timor

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.indexOf("comment_author_url") == -1) { comment_author = unescape(y); } } var _paq = _paq || []; (function(){ var u=(("https:" == document.location.protocol) ? "https://url.instancji.piwika.pl/" : "http://url.instancji.piwika.pl/"); _paq.push(['setSiteId', 1]); _paq.push(['setTrackerUrl', u+'piwik.php']); _paq.push(['setCustomVariable','1','Author', comment_author]); _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript'; g.defer=true; g.async=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s); })(); </script> Źródło http://piwik.org/docs/javascript-tracking/#toc-asynchronous-tracking  external link http://codex.wordpress.org/WordPress_Cookies#Commenters  external link ...

2012-12-21 · 1 min · timor

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 · timor