To add a new tab to the LearnPress profile menu, you can use the learn-press/override-lp-profile-tabs
filter hook. Follow these steps:
Step 1: Add a Custom Tab
Add the following code to your theme’s functions.php
file:
function custom_learnpress_profile_tab( $tabs ) {
$tabs['custom-tab'] = array(
'title' => __( 'Custom Tab', 'learnpress' ),
'slug' => 'custom-tab',
'callback' => 'custom_learnpress_profile_content'
);
return $tabs;
}
add_filter( 'learn-press/profile-tabs', 'custom_learnpress_profile_tab' );
function custom_learnpress_profile_content() {
echo '<h2>Custom Tab Content</h2>';
echo '<p>This is the content of the custom tab.</p>';
}
Step 2: Refresh Permalinks
After adding the code:
- Go to Settings → Permalinks in WordPress.
- Click Save Changes to refresh the permalink structure.
Now, a new “Custom Tab” will appear in the LearnPress Profile Menu, and it will display the custom content.
Let me know if you need modifications! 🚀