RSS Icon Twitter Icon Linked In Icon

Web Threads » Development » Wordpress Plugin Exec-PHP Hack – Disable For Post

Wordpress Plugin Exec-PHP Hack – Disable For Post

If you’re running the Exec-PHP plugin in Wordpress and struggling with posting your php code blocks without it being executed, I’ve made a quick hack to disable this plugin per post by adding a custom field. You just have to remember not to upgrade automatically or you’ll lose the changes. With a few lines of code and a Custom field in on your post entry page, you can disable Exec-PHP and it will skip this content. Note it will still run on other elements, just not the content.


In file plugins/exec-php/includes/runtime.php find the block that starts at line 52:

	function filter_user_content($content)
	{
		global $post;

Add after it:

		// check if this post has disabled exec-php in custom fields
		$custom_fields = get_post_custom(); 
		$php_disable_this_post = $custom_fields['disablephp_exec'];
		$phpexecdisable= $php_disable_this_post[0];
		if ($phpexecdisable =='1')
			return $content;

Add the Custom Field to your post, ‘disablephp_exec’ and give it a value of 1.

Upload your new runtime.php file and you’re off.

This is a great plugin, very useful, but I wish it used code tags instead of standard php tags.

Exec-PHP Plugin on Wordpress
Exec-PHP Homepage

1 person likes this post.

Filed under: Development · Tags: , ,

Leave a Reply