Saturday, September 26, 2015

Allow PHP in Posts and preg_match

Allow PHP in Posts is a very cool plugin when you need to execute PHP in your posts, but you need a little time to get used to it, because it is kind of tricky. For instance I did not manage to use the preg_match function with square brackets. It simply replaces [a-z] with <a-z>. The only fix I could find is to use Code Snippets and add all the preg_match parts there, then use Shortcodes like [php function=5].

Also don't forget about [PHP debug=1] option which can be really useful.

No comments: