# LearnDash: "Edit Course" Link in the Toolbar on Lessons

> Adds an "Edit Course" link to the admin toolbar when you view a lesson, topic or quiz, so you can jump straight to the parent course's builder.

- Type: PHP
- Runs: Frontend only
- Category: [Courses & Community](https://wpide.com/library/category/learning/)
- Tags: learndash, admin-bar, courses
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/learndash-edit-course-admin-bar/

## Code

```php
if ( ! defined( 'LEARNDASH_VERSION' ) ) {
    return;
}

add_action( 'admin_bar_menu', function ( $bar ) {
    if ( ! is_singular( array( 'sfwd-lessons', 'sfwd-topic', 'sfwd-quiz' ) ) ) {
        return;
    }

    $course_id = (int) learndash_get_course_id( get_queried_object_id() );

    if ( ! $course_id || ! current_user_can( 'edit_post', $course_id ) ) {
        return;
    }

    $bar->add_node( array(
        'id'    => 'wpide-ld-edit-course',
        'title' => 'Edit Course',
        'href'  => get_edit_post_link( $course_id ),
    ) );
}, 90 );
```

## Notes

Only shown to users who can edit the course.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "LearnDash: "Edit Course" Link in the Toolbar on Lessons" 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/
