Posts Tagged ‘wordpress multi-user’

I really needed to be able to contain MXML markup code in my Flex blog, yet Wordpress MU (Multi-user) has some HTML and Javascript filtering in effect for security purposes. Since my blogs aren’t used by others, I figured it would be safe to disable that functionality, but it really is not the easiest thing to achieve.

I searched on Google and found a blog dealing with the matter at http://dev.robertmao.com/2007/07/18/get-rid-of-boring-wpmus-post-htmljavascript-filtering/. Since the blogger’s English wasn’t the greatest, I figured I can offer similar information here, hopefully, in a way that is easier to understand.

To achieve this, a very slight modification of one of WPMU’s (Wordpress Multi-user) PHP files, kses.php, which resides in the wp-include folder, will be necessary to achieve this. Using any plain text editor with a basic search function should suffice to edit the file.

Doing a simple text search of wp-include/kses.php for the word “filtering” should yield something similar to the following:

1028
1029
1030
1031
1032
1033
1034
1035
1036
function kses_init_filters() {
	// Normal filtering.
	add_filter('pre_comment_content', 'wp_filter_kses');
	add_filter('title_save_pre', 'wp_filter_kses');
 
	// Post filtering
	add_filter('content_save_pre', 'wp_filter_post_kses');
	add_filter('excerpt_save_pre', 'wp_filter_post_kses');
	add_filter('content_filtered_save_pre', 'wp_filter_post_kses');

To remove the HTML/Javascript filtering, just comment out the add_filter lines below the // Post filtering by inserting a set of // backslashes, resulting in the following:

1028
1029
1030
1031
1032
1033
1034
1035
1036
function kses_init_filters() {
	// Normal filtering.
	add_filter('pre_comment_content', 'wp_filter_kses');
	add_filter('title_save_pre', 'wp_filter_kses');
 
	// Post filtering
	//add_filter('content_save_pre', 'wp_filter_post_kses');
	//add_filter('excerpt_save_pre', 'wp_filter_post_kses');
	//add_filter('content_filtered_save_pre', 'wp_filter_post_kses');

As of this writing, the version of WPMU is 2.6.3, so these lines will reflect that version, though the search for the keyword “filtering” should still yield similar results in other versions.