By default, you can not execute PHP in WordPress posts and pages. We’ve got made it a rule of thumb to by no means execute PHP in our posts and pages both as a result of it may be hectic to vary issues sooner or later. A greater apply can be to edit the WordPress theme by making a customized web page template, or single put up template. Nonetheless for some customers, it might be essential to execute PHP in WordPress posts. We couldn’t discover a want for it, however apparently over 26,000 individuals have. So on this article, we’ll share learn how to permit PHP in WordPress posts and pages.
Merely set up and activate the plugin Permit PHP in Posts and Pages. After set up, merely wrap your php queries contained in the shortcode:
[ php] [ /php] – Please ignore the areas. We can’t use this shortcode as a result of it should pull our Syntax Highlighter Advanced plugin.
You too can save your php queries and name them on put up or pages while you want them. To do that, merely click on on Permit PHP in Posts menu choice. Click on on the Code Snippets Tab. Add your PHP question there.
Then in your put up, merely use the shortcode with the Snippet ID:
[ php function=ID]