WP_REST_Global_Styles_Controller::get_available_actions( WP_Post $post, WP_REST_Request $request ): array

In this article

Get the link relations available for the post and current user.

Parameters

$postWP_Postrequired
Post object.
$requestWP_REST_Requestrequired
Request object.

Return

array List of link relations.

Source

protected function get_available_actions( $post, $request ) {
	$rels = array();

	$post_type = get_post_type_object( $post->post_type );
	if ( current_user_can( $post_type->cap->publish_posts ) ) {
		$rels[] = 'https://api.w.org/action-publish';
	}

	if ( current_user_can( 'edit_css' ) ) {
		$rels[] = 'https://api.w.org/action-edit-css';
	}

	return $rels;
}

Changelog

VersionDescription
6.6.0Added $post and $request parameters.
6.2.0Added 'edit-css' action.
5.9.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.