WP Integration – Slashes the root of all evil
-
So I’ve been digging further into the strange behavior I’ve had with slashes in posts AND with HTML tag attributes being yanked out.
It’s all related. Apparently, there is some type of problem where slashes get added TWICE when the WP intergation is on. This is why slashes start showing up everywhere and why kses fails.
I finally discovered that even though the stripslashes filter is called before bb_filter_kses, there are still slashes in front of the quotes of the attributes. So they get tossed.
So I took out all the stripslashes hacks I had put into the title and post routines and called stripslashes TWICE as a pre_post filter. Voila – attributes are preserved.
add_filter('pre_post', 'stripslashes', 40);
add_filter('pre_post', 'stripslashes', 45); // 2nd Time
I also added this little section in default-filters.php:
// Slash problems when integrated with WordPress
if (defined('WP_BB') && WP_BB) {
add_filter('post_text', 'stripslashes');
add_filter('get_topic_title', 'stripslashes');
add_filter('get_bb_title', 'stripslashes');
add_filter('edit_text', 'stripslashes');
}
And it stripped out the slashes in titles, browser bars, posts, edit screens, etc. (Note there is a missing semi-colon after the sort_tag_heat_map line – you need to add on if you put this at the end)
This is still a hack. I don’t have magic quotes on. I still need to dig and find out why there seems to be alternate behavior when wordpress is integrated or not. Maybe WordPress is turning on magic quotes and bbPress doesn’t expect it to be on?
Still digging.
- You must be logged in to reply to this topic.