bp_blogs_get_blogs( array|string $args = '' )

Retrieve a set of blogs.


Description Description

See also See also


Top ↑

Parameters Parameters

$args

(array|string) (Optional) Arguments are listed here with their default values. For more information about the arguments, see BP_Blogs_Blog::get().

  • 'type'
    (string) Default: 'active'.
  • 'user_id'
    (int|bool) Default: false.
  • 'include_blog_ids'
    (array) Default: false.
  • 'search_terms'
    (string|bool) Default: false.
  • 'per_page'
    (int) Default: 20.
  • 'page'
    (int) Default: 1.
  • 'update_meta_cache'
    (bool) Whether to pre-fetch blogmeta. Default: true.

Default value: ''


Top ↑

Return Return

(array) See BP_Blogs_Blog::get().


Top ↑

Source Source

File: bp-blogs/bp-blogs-functions.php

function bp_blogs_get_blogs( $args = '' ) {

	// Parse query arguments.
	$r = bp_parse_args( $args, array(
		'type'              => 'active', // 'active', 'alphabetical', 'newest', or 'random'.
		'include_blog_ids'  => false,    // Array of blog IDs to include.
		'user_id'           => false,    // Limit to blogs this user can post to.
		'search_terms'      => false,    // Limit to blogs matching these search terms.
		'per_page'          => 20,       // The number of results to return per page.
		'page'              => 1,        // The page to return if limiting per page.
		'update_meta_cache' => true      // Whether to pre-fetch blogmeta.
	), 'blogs_get_blogs' );

	// Get the blogs.
	$blogs = BP_Blogs_Blog::get(
		$r['type'],
		$r['per_page'],
		$r['page'],
		$r['user_id'],
		$r['search_terms'],
		$r['update_meta_cache'],
		$r['include_blog_ids']
	);

	/**
	 * Filters a set of blogs.
	 *
	 * @since 1.2.0
	 *
	 * @param array $blogs Array of blog data.
	 * @param array $r     Parsed query arguments.
	 */
	return apply_filters( 'bp_blogs_get_blogs', $blogs, $r );
}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.