I just threw a couple small PHP classes up on GitHub that I use in almost every WordPress plugin I write. The first is IDAdminNotices , which is a clean and easy way for plugins and themes to send messages/errors to the user within the Administration Panels. The second is IDDescribeVar , which will outputs the type, length and contents… [more]
All posts in PHP
BackPress is a useful project that packages the re-usable code from WordPress into an independent library you can use in non-WordPress projects.
I ran into a small problem upgrading PHP from 5.3.5 to 5.3.10 on a MediaTemple CentOS VPS today. The upgrade completed without any errors, but when I reloaded the site I got a “500 Internal Server Error” message. It was the stock installation, so I’m not sure which module it was using or what repository… [more]
Nikolay Bachiyski gave a good talk at this year’s WordCamp San Francisco about unit testing WordPress plugins . His method uses PHPUnit , which is an additional PEAR package you have to install on the server. You can then use MockPress to simulate WordPress in the tests. Another option is the SimpleTest for WordPress plugin , which uses SimpleTest instead of PHPUnit, doesn’t require installing a PEAR… [more]
Mark Maunder benchmarked several performance tuning measures with a WordPress installation on a VPS server to show which are most effective. The biggest improvements were from installing PHP-APC , setting up Nginx to proxy concurrent connections for Apache, and using MySQL’s query cache.
This is the error you’ll get if you try to install WordPress 3.2 on a PHP4 server: Parse error: parse error, unexpected T_VARIABLE in /path/to/your/directory/wp-includes/load.php on line 566 It’s because the clone keyword doesn’t exist in PHP4 .
If you’re using $wpdb->prepare() to query a custom table, you can’t pass the table name in as an argument because it will be single-quoted, which would be a MySQL syntax error. Instead, you need to insert the variable directly into the double-quoted query string and let PHP parse it out. That creates a new problem,… [more]
Here’s a function I wrote to get the thumbnail URL for a Blip.tv video when all you have is the embed URL. It can parse the embed URL out of a larger block of text (e.g., a blog post). It doesn’t use their API, which makes it easier to setup, but also means it might… [more]
Virtuozzo sets domains up to have PHP’s display_errors flag turned off by default, so that you’ll only see a blank page when there are critical errors. This is a good thing in production environments because it avoids potential security issues, but it can also be annoying when you’re trying to debug something. Instead of displaying… [more]
MySQL doesn’t provide a way to perform natural sorting on a string, so if you have numbers in your data you may get results like this Product 110 Product 120 Product 13 Product 140 There are a lot of hacks available, but all of the ones I’ve seen only work in specific circumstances. The only comprehensive solution… [more]
Richard Lord wrote a good article explaining the various ways of handling dates and times with PHP and MySQL .
Chris Sibert wrote a good tutorial on installing the Oracle library for PHP . If you’re running SELinux, I’d recommend temporarily turning it off to get the module setup so you don’t have to worry about problems during the install, and then turn SELinux back on after you verify the module is working. Then you can update SELinux’s policy to allow Apache and PHP… [more]
I’ve been working on a problem recently with the Pretty Permalinks solution for WordPress on IIS. I was migrating a working WordPress blog from one server to another and once it was on the new server the front page would come up w/ the theme, but instead of the default posts it would say “Sorry, no posts… [more]
I use Pretty WordPress Permalinks on IIS when I need to install WP on a windows server, but on one host I ran into a problem where I would get a blank page if the post didn’t exist instead of the theme’s 404 template. But for some reason it works fine if I just echo something in wp-404-handler.php. I echoed… [more]


