- This topic has 2 replies, 2 voices, and was last updated 7 years, 5 months ago by .
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.
These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.
I am looking to update my sites to PHP7 and was advised by my hosting company that i needed to enable short tags on the site as the developer had disabled this. I dont see this in theme settings and have unsuccesfully Googled it.
This is the extract from my email exchange
By application I mean the website which is hosted under the following path on your system:
Also, as you can see the errors are referring to an undefined variable within the code of the website.
However, looking into this further we have noticed that the developer has used short tags within the code of the application which is a feature disabled by default in PHP 7.
We have enabled the short tags for the website and now the redirects seem to be working fine.
Any advice re this would be appreciated
Your hosting company said that short tags are disabled in PHP7 by default. This is not theme related and is a different kind of short tag than what you may be thinking about.
Normally, when you think about short tags in WordPress, you think about the kind of short tags that developers create that are executed at run time. These short tags are very short snippets that are wrapped in square brackets or are executed with the do_shortcode function. (i.e. [short_code].
PHP short tags are different and refer to inline PHP code. When PHP short tags are enabled, you would execute inline PHP code like this:
<input name="someVar" value="<? echo $someVar; ?>">
When PHP short tags are disabled, the above code will produce an error. To fix the error, you either have to enable short tags in php.ini or the code has to be written:
<input name="someVar" value="<?php echo $someVar; ?>">
that was the most comprehensive answer i got. I spoke to my host and it was as easy as changing an option to allow short code in php 7
It is not enabled by default with my host
© 2023 WPEngine, Inc.