Run PHP code inserted into WordPress posts and pages.
Make a copy of the working PHP code to be used in a post or a page.
Replace "<?php" on the first line with "[insert_php]". Replace "?>" on the last line with "[/insert_php]".
Paste the code into your post or page.
Examples are here: http://www.willmaster.com/software/WPplugins/go/iphpinstructions_iphplugin
Yes. I have found no limit to the number of places PHP code can be inserted into a post or page. Probably there is no WordPress software limit. There may be a server memory limit of your PHP code uses a lot of memory.
No. HTML paragraph and line break formatting are applied to PHP output.
Use the HTML/Text tab. While the Visual tab will, sometimes, the HTML/Text tab allows working with the code without the visual formatting.
With PHP, cookies are set in the web page header lines, before any page content is processed. Redirects, too, are done in the header lines. When PHP code is within a post or a page, all the header lines have already been sent, along with part of the content. At that point, it is too late to set cookies or redirect with PHP.
Unless the source code of the plugin has been changed or somehow became corrupted, the parse error is likely to be in the PHP code inserted into the post or page. Example:
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /public_html/wp331/wp-content/plugins/insert_php.php(48) : eval()'d code on line 5
Either within or at the end of the parse error message you'll find something like this:
eval()'d code on line 5
The error is on the indicated eval()'d code line number of the PHP code you are inserting ("5" in the example). At the PHP code you inserted, count down the number of lines indicated. You'll find the error at that line.
If you have PHP code inserted in more than one place, the error message may apply to any of those places. Temporarily remove or disable them, one at a time, until you determine which one the error message applies to.
If Insert PHP is used with an include() function, the include()'d file may be spawning the error message. In that case, the file name being include()'d and the line number of the error should be somewhere within the error message.
When the error is located, correct it and try again.
Requires: 3.3.1 or higher
Compatible up to: 3.8.1
Last Updated: 2013-12-31
5 of 10 support threads in the last two months have been resolved.
Got something to say? Need help?