wp_redirect() breaks buddypress commenting?
-
Hi All,
I’m sure there’s a simple answer here, but I haven’t been able to find it.
I need to allow subscribers to post to buddypress, but never access the wordpress admin panel. The following code blocks subscribers from the admin panel:
// Block subscribers from the WordPress back end admin function block_subscriber_admin(){ if (current_user_can('subscriber')){ wp_redirect( home_url() ); exit; } } add_action( 'admin_init', 'block_subscriber_admin');
Problem: a side-effect of this code is that it somehow breaks the AJAX for posting and commenting on Buddypress pages. Instead of displaying the newly posted content, buddypress instead renders the home page of the site.
Is there a better way of blocking access to the WP admin panel? One that will not break BP?
Many thanks,
Adam
- The topic ‘wp_redirect() breaks buddypress commenting?’ is closed to new replies.