LearnDash icon

LearnDash

Interact with the LearnDash LMS REST API

Actions60

Group Courses → Add

AI-generated

Summary

Adds existing courses to a LearnDash group by sending a POST request to /wp-json/ldlms/v2/groups/{parentId}/courses with a body containing course_ids.

Inputs

  • parentId (required) — The LearnDash group ID whose course list should be updated. For this resource, Parent ID is the group ID.
  • itemIds — Course IDs to add to the group. Add one Item per course ID; each item’s ID is sent as a numeric course_id. This field is optional in the UI, but you should provide at least one ID to add courses.

Output shape

array

The operation returns the parsed JSON response from the LearnDash API as an array. If the API returns a single object, that object is wrapped in a one-element array.

Examples

Example 1: Workflow has a LearnDash group ID and one or more course IDs that should be associated with that group. It uses the Group Courses > Add operation to make the association.

Add course IDs to an existing LearnDash group.

Discussion