Customize Member Blog behavior using WordPress actions and filters. This guide covers all public hooks available for developers.
Change the URL slug for the blog component in member profiles.
add_filter( 'bp_member_change_blog_slug', function( $slug ) {
return 'my-articles'; // Changes /members/username/blog/ to /members/username/my-articles/
});
Default: blog
Change the label displayed for the blog tab in member profiles.
add_filter( 'bp_member_change_blog_label', function( $label ) {
return 'My Articles';
});
Default: Blog
Control which image types members can upload for featured images.
add_filter( 'bpmb_allowed_image_mime_types', function( $types ) {
return array(
'image/jpeg',
'image/png',
// Removed: image/gif, image/webp
);
});
Default: image/jpeg, image/png, image/gif, image/webp
Override the maximum upload size for featured images (in MB).
add_filter( 'bpmb_max_upload_size', function( $size ) {
return 5; // 5 MB limit
});
Default: Uses admin setting or 2 MB
Filter post data before saving to the database.
add_filter( 'bp_member_blog_post_data', function( $post_data ) {
// Add a prefix to all post titles
$post_data['post_title'] = '[Member] ' . $post_data['post_title'];
return $post_data;
});
Parameters:
$post_data(array) – Post data array with title, content, status, etc.
Change the number of posts shown per page in the dashboard.
add_filter( 'bp_member_blog_posts_per_page', function( $per_page ) {
return 10; // Show 10 posts per page
});
Default: Uses admin setting or 5
Customize which tabs appear in the member dashboard.
add_filter( 'bp_member_blog_dashboard_tabs', function( $tabs ) {
// Remove the pending tab
unset( $tabs['pending'] );
return $tabs;
});
Default Tabs: posts, drafts, pending
Change how often drafts are automatically saved (in seconds).
add_filter( 'bpmb_autosave_min_interval', function( $interval ) {
return 60; // Auto-save every 60 seconds instead of 30
});
Default: 30 seconds
Limit how many new categories members can create per hour.
add_filter( 'bpmb_max_categories_per_hour', function( $limit ) {
return 3; // Only 3 new categories per hour
});
Default: 5 categories per hour
Customize the Content Security Policy headers on editor pages.
add_filter( 'bpmb_csp_policy', function( $policy ) {
// Add a trusted domain for scripts
$policy['script-src'] .= ' https://trusted-cdn.com';
return $policy;
});
Control whether a user can create posts. Used by PRO plugin for restrictions/credits.
add_filter( 'bpmb_can_create_post', function( $can_create, $user_id ) {
// Block users with less than 10 posts site-wide
if ( count_user_posts( $user_id ) < 10 ) {
return false;
}
return $can_create;
}, 10, 2 );
Parameters:
$can_create(bool) – Current permission status$user_id(int) – User ID being checked
Triggered when a member post is published.
add_action( 'bpmb_post_published', function( $post_id, $author_id ) {
// Send notification to admin
wp_mail(
get_option( 'admin_email' ),
'New Member Post Published',
'A new post was published: ' . get_permalink( $post_id )
);
}, 10, 2 );
Parameters:
$post_id(int) – The published post ID$author_id(int) – The post author’s user ID
Triggered when a post is saved (create or update).
add_action( 'buddypress_member_blog_post_save', function( $post_id ) {
// Log the save action
error_log( 'Post saved: ' . $post_id );
});
Triggered when a post is submitted via the frontend form.
add_action( 'buddypress_member_blog_post_submit', function( $post_id, $post_data ) {
// Add custom meta data
update_post_meta( $post_id, '_submitted_from', 'frontend' );
}, 10, 2 );
Triggered after a post’s view count is incremented.
add_action( 'bpmb_after_view_increment', function( $post_id, $new_count ) {
// Trigger something at 100 views
if ( $new_count === 100 ) {
// Send congratulations email to author
}
}, 10, 2 );
Add content to the dashboard tab navigation area.
add_action( 'bp_member_blog_dashboard_tabs_nav', function() {
echo 'Custom Tab';
});
Handle content for custom dashboard tabs.
add_action( 'bp_member_blog_dashboard_custom_tab', function( $tab ) {
if ( $tab === 'custom' ) {
echo 'Custom tab content here';
}
});
Add content before the featured image upload field.
add_action( 'bp_post_before_featured_image', function() {
echo 'Upload an eye-catching image
';
});
Add content after the category selector.
add_action( 'bp_post_after_category', function() {
// Add custom field or options
});
Add content before the submit button.
add_action( 'bp_post_before_submit_button', function() {
echo '';
});
Add custom options to the Access & Permissions settings tab.
add_action( 'bp_member_blog_add_access_settings_options', function() {
?>
Custom Access Option
});
Add custom options to the Editor settings tab.
add_action( 'bp_member_blog_add_editor_settings_options', function() {
// Add custom editor settings
});
// In your theme's functions.php or a custom plugin
add_filter( 'bp_member_change_blog_slug', function() {
return 'articles';
});
add_filter( 'bp_member_change_blog_label', function() {
return 'My Articles';
});
Result: Member blog URL changes from /members/john/blog/ to /members/john/articles/
add_filter( 'bpmb_can_create_post', function( $can_create, $user_id ) {
// Check for verified user meta
$is_verified = get_user_meta( $user_id, 'account_verified', true );
if ( ! $is_verified ) {
return false;
}
return $can_create;
}, 10, 2 );
add_action( 'buddypress_member_blog_post_submit', function( $post_id ) {
// Add submission timestamp
update_post_meta( $post_id, '_frontend_submission_time', current_time( 'mysql' ) );
// Add user's IP (for moderation)
update_post_meta( $post_id, '_author_ip', $_SERVER['REMOTE_ADDR'] );
});
add_action( 'bpmb_post_published', function( $post_id, $author_id ) {
$post = get_post( $post_id );
$author = get_userdata( $author_id );
$message = sprintf(
'New post by %s: %s - %s',
$author->display_name,
$post->post_title,
get_permalink( $post_id )
);
// Send to Slack webhook
wp_remote_post( 'https://hooks.slack.com/services/YOUR/WEBHOOK/URL', array(
'body' => json_encode( array( 'text' => $message ) ),
'headers' => array( 'Content-Type' => 'application/json' ),
));
}, 10, 2 );
// Add the tab
add_filter( 'bp_member_blog_dashboard_tabs', function( $tabs ) {
$tabs['analytics'] = 'My Analytics';
return $tabs;
});
// Handle the tab content
add_action( 'bp_member_blog_dashboard_custom_tab', function( $tab ) {
if ( $tab === 'analytics' ) {
$user_id = get_current_user_id();
$total_views = get_user_meta( $user_id, 'total_post_views', true );
echo '';
echo 'Your Post Analytics
';
echo 'Total Views: '
. intval( $total_views ) . '';
echo '';
}
});
add_filter( 'bpmb_allowed_image_mime_types', function() {
return array( 'image/jpeg' );
});
// Save drafts every 2 minutes instead of 30 seconds
add_filter( 'bpmb_autosave_min_interval', function() {
return 120;
});
