Tagged: buddypress, yoast
Hi, BuddyDev.
I have a little problem with the compatibility of BuddyPress and Yoast Seo plugins. I already read this post https://buddydev.com/buddypress/making-wordpress-seo-plugin-compatible-with-buddypress-part-2/
and tried the solution. It did not help me.
Let me describe the issue. I don’t use BP for groups etc. I simply use it so that my users have accounts and can write posts on my website.
I use the following code which redirects to users profiles instead of their archives. I use it in funtions.php/* check if custom function file is active */
if( file_exists( WP_CONTENT_DIR . ‘/meso-custom-functions.php’ ) ) {
include_once( WP_CONTENT_DIR . ‘/meso-custom-functions.php’ );
}add_action( ‘template_redirect’, ‘authorblog_template_redirect’ );
function authorblog_template_redirect(){
if(is_author()){
if(get_query_var(‘author_name’)) :
$curauth = get_user_by(‘slug’, get_query_var(‘author_name’));
else :
$curauth = get_userdata(get_query_var(‘author’));
endif;
wp_redirect(‘http://www.my website name/members/’. $curauth->nickname );
}
}When I installed Yoast Seo, this code stopped working. So when you click on user name, you get directed to the main page.
Any ideas how to fix this?
I would really appreciate any help.Hi Alexandra,
Please remove the code from above post and give it a tryfunction buddydev_author_redirect_to_profile() { if ( is_author() && function_exists( 'bp_core_redirect' ) ) { $author_id = get_queried_object_id(); bp_core_redirect( bp_core_get_user_domain( $author_id ) ); } } add_action( 'template_redirect', 'buddydev_author_redirect_to_profile' );
Put it in your functions.php and let me know if it works or not?
Thank you
BrajeshHi Alexandra,
You do not need any other code. Just the code from this topic will do it. Please remove any other code if you have already added.Thank you
BrajeshHi Alexandra,
I just tested it again.I am on multisite and I tested with Latest WordPress, BuddyPress and Yoast SEO. The code works great.
Are you using any specific setting in yoast seo or any 3rd party redirection plugin?
You must be logged in to reply to this topic.