Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Set default activity stream filter
<?php
/**
* Set default activity stream filter.
*/
function yzc_set_default_activity_directory_filter() {
if ( isset( $_COOKIE['bp-activity-filter'] ) || ! bp_is_activity_directory() ) {
return ;
}
// Filter
$filter = 'activity_status';
// Set Cookies.
setcookie( 'bp-activity-filter', $filter,null, '/' );
$_COOKIE['bp-activity-filter'] = $filter;
}
add_action( 'bp_template_redirect', 'yzc_set_default_activity_directory_filter' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment