Skip to:

Re: rawurlencode() Error

Well, I came up with an ugly fix, especially since I don’t actually know what I’m doing.

I’ve been trying to integrate the BBpress forum right inside my WP theme, which is what I imagine you were trying to do.

To fix it I added this switch right at the top of my bbpress template header:

$bbpressswitch = 1;


Then I went into classes.php for wordpress and put an if/else ‘switch’, basically:

The first line there is 1645 in my file

function build_query_string() {

$this->query_string = ”;

foreach ($this->public_query_vars as $wpvar) {

if (isset($this->query_vars[$wpvar]) && ” != $this->query_vars[$wpvar]) {

$this->query_string .= (strlen($this->query_string) < 1) ? ” : ‘&’;

// bug fix for BBpress integration

if ($bbpressswitch == 1) {

// $this->query_string .= $wpvar . ‘=’ . rawurlencode($this->query_vars[$wpvar]);

// if the url is being accessed from a page outside of WP that is using the header

// or other data, turn off this URL encoding.

} else {

$this->query_string .= $wpvar . ‘=’ . rawurlencode($this->query_vars[$wpvar]);


// end of bug fix



It’s ugly, and I’m a n00b at this stuff, but it does seem to have cleaned up my error. I guess the bbpress URL’s don’t work so good when sent through the WP URLencode setup, so turning them off when going into a BBpress page seemed like it might work.

I don’t know if there are any other repurcussions from this change, but again, it turned off the error, and I haven’t seen any fallout…yet.

There are other sites online that seem to offer a fix for the same issue, like this:

But the fix they suggest kills all of your static pages or category links and always sends you to the main blog page.

Skip to toolbar