Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP Short tags validation in a wordpress theme

Tags:

php

wordpress

I am designing a wordpress theme and i'm using a plugin that validates the theme

after validation i have alot of 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 am lead to believe that php short tag was something like the following

<? if ($topbaronoff == 'on'): ?>
like image 236
thenashone Avatar asked Feb 12 '26 15:02

thenashone


1 Answers

I assume you're using Theme Check plugin for Wordpress. I took a look at its source code, and yes, the short tags validation is broken there. Take a look at the PHPShortTags check, line 11: it will only match lower-case <?php opening tag, causing a warning for <?PHP.

This is a good reason to file a bug report for this plugin. But also I'd like to note that though <?PHP is a valid PHP open tag, you shouldn't really use it, as most coding standards deny such syntax.

like image 60
kix Avatar answered Feb 14 '26 04:02

kix



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!