Reusable PHP
An Open Letter to WordPress Plugin Authors
Please, when developing your plugins, be sure to always use the full opening tag for PHP:
<?php code goes here ?>
On some servers—maybe even your own—you can shorten this to just the opening <?
, as in:
<? code goes here ?> <!-- Please don't do this -->
The following line in php.ini will disable this “feature,” and many web server administrators do so to simplify things like generating XML with PHP:
short_open_tag = Off
When this option is set, PHP will ignore <?
and assume it’s simply part of the template… along with all the code following it. If you’re lucky, it means a bunch of PHP code gets sent to the web browser. If you’re not lucky, it results in invalid syntax, and PHP grinds to a halt, spitting out a blank page and a PHP Parse Error.
So please make sure you always use the full opening tag so that your plugin will be compatible with everyone’s system. If you run your own server, set that option in php.ini so that if you miss one, you can catch it before you post it.