Archive | WordPress

PHP is_numeric () fails WordPress version string check

This is, perhaps, obvious to most PHP developers. But it came somewhat as a surprise to me.

Using is_numeric () for validating a WordPress version string, such as ‘4.7’, does not seem to work very well when WordPress introduces minor releases such as ‘4.7.1’.

Since I cannot be bothered to figure out why it behaves in this (erratic, IMHO) way, I have since replaced the call to is_numeric () with a small function using a simple regular expression (regexp):

    function wpVersionStringCheck ($vs)                                                                                                 
        return (preg_match ('/^(\d+\.)+\d+$/', $vs));                                                                                   

I’m sure there is a hole in there somewhere, but on the following strings at least, it gives me the desired result:

1.0 is valid
1.0. is invalid
1.0.1 is valid
1.banana.0 is invalid


Limiting the number of revisions in WordPress

Tired of nine zillion revisions of your posts created on your WordPress site?

Open up wp-config.php with a nice editor like Emacs or Pico/Nano or VI and add:

define('WP_POST_REVISIONS', false );

to disable post revisions completely.

Or, if you just want to limit the number of revisions WordPress keeps:

define('WP_POST_REVISIONS', 3);


Of course, this is just a simple Google query away from you:

Or, as it happens:


So long Serendipity (S9Y), JoHo is converting to WordPress

Well, I guess it had to happen at some point. I’ve been running Serendipity (S9Y) for as long as I can remember “blogging”. At one point I was coding something that looked a lot like some early version of WordPress and S9Y, but I gave up on it. Since there are so many talented developers out there, I didn’t have to wait long for some nice alternatives to show up.

When WordPress 3 arrived, I decided it was time to move away from S9Y. I do a lot of WordPress-related stuff at work, and the time when I thought tinkering with “odd” bits and pieces just because I had nothing better to do has long since passed. These days I do it because I have something better to do but can’t keep my hands away 🙂

During the next few weeks, I’ll get a lot of stuff back here again, but I’d like to extend a big “THANK YOU” to this post:

Serendipity to WordPress – Post import


WordPress-mall: Retro

retro-adBland alla de mallar som finns för WordPress hittar man ibland en del udda saker. Retro-mallen frÄn Kerry Webster Àr en sÄdan udda sak. Det lÄter som en jÀttekul idé, och kÀnns initialt lite roligt. Men handen pÄ hjÀrtat, hade det inte varit bÀttre om man inte behövt stirra pÄ en fosfor-grön sida.

För de som inte var med, eller kommer ihÄg, sÄ sÄg skÀrmarna ut sÄ hÀr för 20+ Är sedan. VÀldigt retro Àr det i alla fall.


Powered by WordPress. Designed by WooThemes