简体   繁体   English

通过传递ID来获取buddypress组子弹

[英]Get buddypress group slug by passing its ID

I would like to be able to get a link to a specific buddypress group but by only using the groups ID on a template page. 我希望能够仅通过使用模板页面上的组ID来链接到特定的buddypress组。

The admin inputs the groups ID as a custom field on the page, then using this I would like it to be able to generate the groups slug to then create a link to it 管理员在页面上将组ID输入为自定义字段,然后使用它,我希望它能够生成组条目,然后创建指向它的链接

Any help is appreciated 任何帮助表示赞赏

To get a buddypress group slug from a group id: 要从组ID获取buddypress组子弹:

$group_id = 2;    
$group = groups_get_group( array( 'group_id' => $group_id ) );
$slug = $group->slug;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM