Grep command to find all PHP shortcode entries

Grep command to find all PHP shortcode entries

As PHP files are moved from one server to the other,  occassionally we find a situateion where PHP was developed on a server that allowed shortcodes “<?”  which does not use the longer “<?php”  if this happens,  the PHP code does not execute and shows the code that would have executed,  on the output of the page.

When this happens I have found that using a simple command I can identify all of the places that use the short code

 grep -n '<?[^p=]' *.php

Leave a Reply

Your email address will not be published. Required fields are marked *