Skip to content

Batch-assign posts to a section

PUT
/wp-json/wp2/course-manager/v1/assign
curl --request PUT \
--url https://example.com/wp-json/wp2/course-manager/v1/assign \
--header 'Content-Type: application/json' \
--header 'X-WP-Nonce: <X-WP-Nonce>' \
--data '{ "ids": [ 1 ], "sectionId": 1 }'

Assigns a batch of posts (ids) to sectionId. sectionId=null clears the assignment (unassigned).

Media typeapplication/json
object
ids
required

Array of numeric post IDs.

Array<integer>
sectionId
required

Section ID; null clears the assignment.

integer
nullable
Example
{
"ids": [
1
],
"sectionId": 1
}

OK

Media typeapplication/json
object
ok

Whether the operation succeeded.

boolean
sections

Course Manager items.

Array<object>
object
id

Numeric entity id.

integer
name

Human-readable name.

string
slug

Slug (site, post, or section).

string
count

Count.

integer
order

Sort order.

integer
icon

Section icon.

string
allCount

Total posts of this type.

integer
unassigned

How many posts have no section.

integer
Examplegenerated
{
"ok": true,
"sections": [
{
"id": 1,
"name": "example",
"slug": "example",
"count": 1,
"order": 1,
"icon": "example"
}
],
"allCount": 1,
"unassigned": 1
}

Wp2sf_bad_post_type / wp2sf_empty_ids

Media typeapplication/json
object
code

Machine-readable error or event code.

string
message

Message text (log, PIN, or password reset).

string
data

Extra WP_Error or license payload.

object
Examplegenerated
{
"code": "example",
"message": "example",
"data": {}
}

Not authenticated. WordPress REST: rest_not_logged_in / rest_forbidden. Use cookie + X-WP-Nonce or Application Password.

Media typeapplication/json
object
code

Machine-readable error or event code.

string
message

Message text (log, PIN, or password reset).

string
data

Extra WP_Error or license payload.

object
Examplegenerated
{
"code": "example",
"message": "example",
"data": {}
}

Insufficient capability or invalid REST nonce. WordPress REST: rest_forbidden / rest_cookie_invalid_nonce.

Media typeapplication/json
object
code

Machine-readable error or event code.

string
message

Message text (log, PIN, or password reset).

string
data

Extra WP_Error or license payload.

object
Examplegenerated
{
"code": "example",
"message": "example",
"data": {}
}