Читать книгу Professional WordPress Plugin Development - Brad Williams - Страница 66
Shorthand PHP
ОглавлениеYou should never use shorthand PHP tags ( <?
and ?>
) when developing plugins. Shorthand tags must be enabled on the server to work. As a plugin developer, you typically won't have access to the server, so there's no guarantee they'll work for your users. Always use the full PHP opening and closing tags ( <?php
and ?>
).
The one exception to this rule is for the short echo tag, as shown in the following example:
<?= 'Hello, World!'; ?>
The short echo tag is always enabled as of PHP 5.4. This is uncommon usage and not standard for WordPress. It's typically used in templates, which is not the primary use case for plugins.