Run PHP Code in WordPress Posts and Pages

Standard

Insert PHP Plugin

Run PHP code inserted into WordPress posts and pages.

The PHP code is between special tags (“[insert_php]” instead of “”).

The PHP code runs as the page is sent to the browser. Output of the PHP code is published directly onto the post or page where the PHP code between the special tags is located.

The code between the tags must be complete in and of itself. References to variables or code blocks outside the area between the tags will fail. See the “more information” URL for an explanation of this.

Using Insert PHP

To use, paste the PHP code into the post or page and then:

Write PHP code between [insert_php] and [/insert_php]


[insert_php]
echo "Hello, World!";
echo "You are my friend :)";
[/insert_php]

Installing Insert PHP

Insert PHP can be installed from the WordPress Dashboard or uploaded to the /plugins directory.

To install from the WordPress Dashboard:

At the “Plugins – Add New” dashboard menu item:

Search for “Insert PHP”

Click the plugin’s “Install Now” link.

To upload to the /plugins directory:

Download Insert PHP from either the WordPress.org plugin page or directly from this link.

Unzip the downloaded file.

Upload the unzipped “insert-php” directory to the WordPress /plugins directory.

When Installed or Uploaded:

After Insert PHP has been installed via the dashboard or uploaded into the /plugins directory, activate the plugin.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s