如何获取与WordPress相关的所有BuddyPress页面?我的意思是,我会用下面的图片来阐述:

每个人都可以根据图像看到5个页面(小部件、测试目的、主页、关于我们、博客),这些是我创建的WordPress页面,所有这些页面都分配给BuddyPress组件目录。现在我想得到所有这些指定的页面。是否有用于此目的的内置函数,或者是否有任何策略来获取这些页面?
发布于 2015-10-19 20:26:36
您应该能够使用在文件bp_core_get_directory_page_ids中定义的函数bp-core/bp-core-functions.php。
/**
* Fetch a list of BP directory pages from the appropriate meta table.
*
* @since BuddyPress (1.5.0)
*
* @param string $status 'active' to return only pages associated with active components, 'all' to return all saved
* pages. When running save routines, use 'all' to avoid removing data related to inactive
* components. Default: 'active'.
* @return array|string An array of page IDs, keyed by component names, or an
* empty string if the list is not found.
*/
function bp_core_get_directory_page_ids( $status = 'active' ) {它将返回一个类似于:
array(4) {
["activity"]=>
int(72)
["members"]=>
int(73)
["register"]=>
int(74)
["activate"]=>
int(75)
}数组值是WordPress中的页面ID,分配给这些组件。
https://stackoverflow.com/questions/33222974
复制相似问题