How to Execute PHP code in WordPress MU

After upgrading from WordPress to WordPress MU 2.6.5, and importing of about 4 MB of posts and comments, I’ve noticed that ALL my posts using code between < and > stopped working. I did some googling on this Issue and found out that WordPress MU is programmed in a way to prevent this kind of code from functioning.

SECURITY RISK!!!
The reason why all code is stripped from your posts upon saving is that hackers could easily install some flash code which could get to directories above the root directory on the server, and this would be an Important Security Issue, opening a Loophole to your Server files.

Since I’m the only one using my WordPress Multiuser installation, I don’t have this problem.

You will have to do 2 things. First, get the “Execute PHP Code Plugin”, unzip, upload to your plugins folder (there is no configuration to be done).
I found this file on the web, at Pryadis’s place. The thing is that he gives you the file as a text file and it is missing the closing > bracket in the end, so it won’t work if you download it from there without adding the > to the end, before you save it as a name.php file.

Now you will have to open the kses.php file in your wp-includes folder. On line(s) 1034 and 1035 (in my case) you will find this line:

add_filter(‘content_save_pre’, ‘wp_filter_post_kses’);

just add // in front of this line to see:

//add_filter(‘content_save_pre’, ‘wp_filter_post_kses’);

Upload the file, and you are ready to go.
This trick is actually posted on “It’s just another Biz”

Incoming search terms:

No related posts.

Tags: MU Plugins, MU trouble

One Response to “How to Execute PHP code in WordPress MU”

  1. [...] > brackets, and you will further have to edit you kses.php file in the wp-includes folder. Go to my “Execute PHP code on WordPress MU” post for all [...]

Leave a Reply