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
After successful installation create your first short code.
Goto Tools >> Shortcode Exec PHP
I hope this tutorial will help you understand how to run PHP code in WorldPress post/page.