# BuddyPress: Add a Custom Tab to Member Profiles

> Adds a new tab to every BuddyPress member profile with your own content, for example "Portfolio" showing the member's posts.

- Type: PHP
- Runs: Run everywhere
- Category: [Users](https://wpide.com/library/category/users/)
- Tags: buddypress, profile, navigation
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/buddypress-custom-profile-tab/

## Code

```php
if ( ! function_exists( 'buddypress' ) ) {
    return;
}

$wpide_bp_tab_name = 'Articles';
$wpide_bp_tab_slug = 'articles';

add_action( 'bp_setup_nav', function () use ( $wpide_bp_tab_name, $wpide_bp_tab_slug ) {
    bp_core_new_nav_item( array(
        'name'                    => $wpide_bp_tab_name,
        'slug'                    => $wpide_bp_tab_slug,
        'position'                => 70,
        'default_subnav_slug'     => $wpide_bp_tab_slug,
        'show_for_displayed_user' => true,
        'screen_function'         => function () {
            add_action( 'bp_template_content', function () {
                $posts = get_posts( array( 'author' => bp_displayed_user_id(), 'numberposts' => 10, 'no_found_rows' => true ) );

                if ( ! $posts ) {
                    echo '<p>No articles yet.</p>';
                    return;
                }

                echo '<ul class="wpide-bp-articles">';
                foreach ( $posts as $post ) {
                    printf( '<li><a href="%1$s">%2$s</a> <small>%3$s</small></li>', esc_url( get_permalink( $post ) ), esc_html( get_the_title( $post ) ), esc_html( get_the_date( '', $post ) ) );
                }
                echo '</ul>';
            } );

            bp_core_load_template( 'members/single/plugins' );
        },
    ) );
}, 100 );
```

## Notes

The example lists the member's published posts; replace the content callback with your own output.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "BuddyPress: Add a Custom Tab to Member Profiles" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
