Connect with us

WordPress Guides

How to Run PHP Code in WordPress Posts and Pages 2022

Some times coders or WordPressers need to run a PHP code in their site to but pure WordPress does not support running PHP codes.

But Insert PHP plugin will help you running any PHP code within your blog page or post simply by inserting your PHP code in the post or page body without modifying any file and does not need any coding skills. Just copy and paste PHP code!

Insert PHP WordPress Plugin

With Insert PHP plugin, WordPress will run any embedded PHP code quickly and without any problem. So WordPress simply can do pretty much anything PHP could do if it was embedded in the PHP templates.

Another good feature in Insert PHP plugin is the plugin code itself; the code is short, less than 30 lines, and all in one file for quick loading and running, so it will not slow your site loading.

Installing Insert PHP plugin

WordPress plugin installation is pretty simple and straightforward.

You can download the plugin zip file and upload it to WordPress or you can install free plugins from within WordPress dashboard.

Manually Install The Plugin

  1. Download Insert PHP plugin from’s Plugin page
  2. Go to WordPress Admin Panel → Plugins → Add New → Upload Plugin [top left].
  3. Click “Browse” or “choose file” → select the Plugin archive which you have downloaded in step #1 → click “Install Now”.
  4. Wait for the file to be uploaded and then click “activate plugin”.

Automatic Installation

  1. Go to WordPress Admin Panel → Plugins → Add New.
  2. In the search area type “Insert PHP” and click Enter.
  3. In the search results choose the plugin called “Insert PHP” and click “Install Now”.
  4. Wait for the file to be downloaded to your host and then click “activate plugin”.

Using Insert PHP plugin

Insert PHP is very simple and easy to use.

To use it, just paste the PHP code into WordPress visual editor and then replace the opening PHP tag <?php with [insert_php] and replace the closing ?> tag with [/insert_php] in your PHP code and you’re good to go.

It can be that simple!

Looking for php 7 hosting?
read this: Best PHP 7 Hosting providers compared

  When you may want to use Insert PHP?

  1. You can use Insert PHP to Publish local time (users’ computer clock settings being unreliable).
  2. Also, you can use it to Insert output of a PHP script, or just to run a script whether or not it generates output.
  3. Check/manipulate cookies or other actions that JavaScript can accomplish when using JavaScript is undesirable.

You can use it to run any PHP code in WordPress posts and pages, so there is no limit to what you can do with it!

Click to comment

Leave a Reply


Must See


More in WordPress Guides