Title: WP_REST_Templates_Controller::get_available_actions
Published: July 20, 2021
Last modified: May 20, 2026

---

# WP_REST_Templates_Controller::get_available_actions(): string[]

## In this article

 * [Return](https://developer.wordpress.org/reference/classes/wp_rest_templates_controller/get_available_actions/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_rest_templates_controller/get_available_actions/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_rest_templates_controller/get_available_actions/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_rest_templates_controller/get_available_actions/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_rest_templates_controller/get_available_actions/?output_format=md#wp--skip-link--target)

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

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_rest_templates_controller/get_available_actions/?output_format=md#return)󠁿

 string[] List of link relations.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_rest_templates_controller/get_available_actions/?output_format=md#source)󠁿

    ```php
    protected function get_available_actions() {
    	$rels = array();

    	$post_type = get_post_type_object( $this->post_type );

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

    	if ( current_user_can( 'unfiltered_html' ) ) {
    		$rels[] = 'https://api.w.org/action-unfiltered-html';
    	}

    	return $rels;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php#L986)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php#L986-L1000)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_rest_templates_controller/get_available_actions/?output_format=md#related)󠁿

| Uses | Description | 
| [current_user_can()](https://developer.wordpress.org/reference/functions/current_user_can/)`wp-includes/capabilities.php` |

Returns whether the current user has the specified capability.

  | 
| [get_post_type_object()](https://developer.wordpress.org/reference/functions/get_post_type_object/)`wp-includes/post.php` |

Retrieves a post type object by name.

  |

| Used by | Description | 
| [WP_REST_Templates_Controller::prepare_item_for_response()](https://developer.wordpress.org/reference/classes/wp_rest_templates_controller/prepare_item_for_response/)`wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php` |

Prepare a single template output for response

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_rest_templates_controller/get_available_actions/?output_format=md#changelog)󠁿

| Version | Description | 
| [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_rest_templates_controller%2Fget_available_actions%2F)
before being able to contribute a note or feedback.