Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: How do I turn off the redirect on an ajax favorite click?

@mattbru

Participant

Robin, Yes – I’ve dug pretty deep myself and it is all pretty complicated.

I’ve tried the action you provided and it does not do anything different, unfortunately.

Topics

Earlier – I did try “hacking” (editing bbpress core plugin code) and changing the redirect as you did here with the hook. But I could not get it to stay on the homepage then either.

Hm. Maybe its not possible? I coudlnt find the exact code where it was happening. I thought it was inside the bbp_favorites_handler() function located here: bbpress/includes/users/functions.php line 430 Looks like youre using that hook on line 481 (bbp_favorites_handler).

I wonder if it has to do with either of these actions:
template_redirect
bbp_template_redirect

I tried this modified version of your hook code:

add_action( 'bbp_favorites_handler', 'tcdf_redirect_to_home_page' , 99, 1) ;
function tcdf_redirect_to_home_page ($success) {
	if ( true === $success && (is_front_page() || is_home() || is_page(2)) ) {
		$redirect = home_url() ;
		wp_safe_redirect( $redirect );
		// For good measure
		exit();
	}		
}

No luck. 🙁

Skip to toolbar