PHP short tag validation in Wordpress theme

I am developing a wordpress theme and I am using a plugin that validates the theme

after checking I have many errors;

WARNING: Found PHP short tags in file header.php.

Line 25: <?PHP if ($topbaronoff == 'on'): ?>

Line 27: <?PHP if ($topmenuonoff == 'on'): ?>

Line 32: <?PHP endif; ?>

      

I was lucky that the php short tag was like the following

<? if ($topbaronoff == 'on'): ?>

      

+3


source to share


1 answer


I am assuming you are using the Theme Check WordPress plugin . I took a look at its source code and yes there is a short tag validation checked. Have a look at PHPShortTags check , line 11: it will only match the open tag <?php

in lowercase, triggering a warning for <?php

.



This is a good reason to write a bug report for this plugin. But I would also like to point out that although this <?php

is a valid PHP open tag, you should not use it, as most coding standards reject this syntax.

+2


source







All Articles