How to allow PHP code In WordPress Page and Post

In this tutorial I’ll tell you how to insert PHP code in your WordPress Page and post. Actually by default WordPress does not execute PHP in post and page content unless it has a short code.

There is two basic method to do this.

1. Create your own short code in function.php and call where you want.
2. The quickest and easiest way to do this is to use a plugin from WordPress plugin directory that allows you to run PHP code in post and page content.




So here we will talk about the second option which is quickest and easiest to use for any newbie WordPress Developer.



Fist you need to install plugin name Shortcode Exec PHP
https://wordpress.org/plugins/shortcode-exec-php/

After successful installation create your first short code.
Goto Tools >> Shortcode Exec PHP

Now enter the name of shot code and click on add button see below screen shot.
worldpress-php-1

After that your short code has been created and ready to use. just call your short code name where you want to use it like..
wordpress-php-2

See the output below.
wordpress-php-3

I hope this tutorial will help you understand how to run PHP code in WorldPress post/page.

If you like this post please don’t forget to subscribe My Public Notebook for more useful stuff.