Buddypress/bbpress remove rel=”nofollow” in links
-
It makes little sense to set nofollow links on my site from trusted members. Is there a quick functions.php fix that will remove the no follow tag on external links for accounts who have admin or editor status only? or even just a remove for all roles?
For bbpress I have tried:
add_filter (‘bbp_get_topic_content’ , ‘follow_topic_if_admin’ , 10 , 2) ;
function follow_topic_if_admin ($content, $topic_id) {
$user_id = bbp_get_topic_author_id( $topic_id ) ;
$user_meta=get_userdata($user_id);
$user_roles=$user_meta->roles;
$allowed_roles = array(‘editor’, ‘administrator’);
if( array_intersect($allowed_roles, $user_roles ) ) {
remove_filter( ‘bbp_get_topic_content’, ‘bbp_rel_nofollow’, 50 );
}
return apply_filters( ‘follow_topic_if_admin’, $content, $topic_id );
}add_filter (‘bbp_get_reply_content’ , ‘follow_reply_if_admin’ , 10 , 2) ;
function follow_reply_if_admin ($content, $reply_id) {
$user_id = bbp_get_reply_author_id( $reply_id ) ;
$user_meta=get_userdata($user_id);
$user_roles=$user_meta->roles;
$allowed_roles = array(‘editor’, ‘administrator’);
if( array_intersect($allowed_roles, $user_roles ) ) {
remove_filter( ‘bbp_get_reply_content’, ‘bbp_rel_nofollow’, 50 );
}
return apply_filters( ‘follow_reply_if_admin’, $content, $reply_id );
}But that proves unsuccessful as I think buddypress is ignoring it using
https://buddypress.wp-a2z.org/oik_api/bp_activity_make_nofollow_filter_callback/Any help would be great as I have search and searched and there is no solution anywhere online for this.
Thank you.
- The topic ‘Buddypress/bbpress remove rel=”nofollow” in links’ is closed to new replies.