WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WPCF7_REST_Controller::register_routes() public CF7 1.0

{} Это метод класса: WPCF7_REST_Controller{}

Ищем WP-разработчика! Фулл-тайм, удаленка, хорошая зарплата, соц. пакет. Подробности.
Компания Boosta.

Хуков нет.

Возвращает

null. Ничего.

Использование

$WPCF7_REST_Controller = new WPCF7_REST_Controller();
$WPCF7_REST_Controller->register_routes();

Код WPCF7_REST_Controller::register_routes() CF7 5.5.1

public function register_routes() {

	register_rest_route( self::route_namespace,
		'/contact-forms',
		array(
			array(
				'methods' => WP_REST_Server::READABLE,
				'callback' => array( $this, 'get_contact_forms' ),
				'permission_callback' => function () {
					if ( current_user_can( 'wpcf7_read_contact_forms' ) ) {
						return true;
					} else {
						return new WP_Error( 'wpcf7_forbidden',
							__( "You are not allowed to access contact forms.", 'contact-form-7' ),
							array( 'status' => 403 )
						);
					}
				},
			),
			array(
				'methods' => WP_REST_Server::CREATABLE,
				'callback' => array( $this, 'create_contact_form' ),
				'permission_callback' => function () {
					if ( current_user_can( 'wpcf7_edit_contact_forms' ) ) {
						return true;
					} else {
						return new WP_Error( 'wpcf7_forbidden',
							__( "You are not allowed to create a contact form.", 'contact-form-7' ),
							array( 'status' => 403 )
						);
					}
				},
			),
		)
	);

	register_rest_route( self::route_namespace,
		'/contact-forms/(?P<id>\d+)',
		array(
			'args' => $this->get_argument_schema(),
			array(
				'methods' => WP_REST_Server::READABLE,
				'callback' => array( $this, 'get_contact_form' ),
				'permission_callback' => function ( WP_REST_Request $request ) {
					$id = (int) $request->get_param( 'id' );

					if ( current_user_can( 'wpcf7_edit_contact_form', $id ) ) {
						return true;
					} else {
						return new WP_Error( 'wpcf7_forbidden',
							__( "You are not allowed to access the requested contact form.", 'contact-form-7' ),
							array( 'status' => 403 )
						);
					}
				},
			),
			array(
				'methods' => WP_REST_Server::EDITABLE,
				'callback' => array( $this, 'update_contact_form' ),
				'permission_callback' => function ( WP_REST_Request $request ) {
					$id = (int) $request->get_param( 'id' );

					if ( current_user_can( 'wpcf7_edit_contact_form', $id ) ) {
						return true;
					} else {
						return new WP_Error( 'wpcf7_forbidden',
							__( "You are not allowed to access the requested contact form.", 'contact-form-7' ),
							array( 'status' => 403 )
						);
					}
				},
			),
			array(
				'methods' => WP_REST_Server::DELETABLE,
				'callback' => array( $this, 'delete_contact_form' ),
				'permission_callback' => function ( WP_REST_Request $request ) {
					$id = (int) $request->get_param( 'id' );

					if ( current_user_can( 'wpcf7_delete_contact_form', $id ) ) {
						return true;
					} else {
						return new WP_Error( 'wpcf7_forbidden',
							__( "You are not allowed to access the requested contact form.", 'contact-form-7' ),
							array( 'status' => 403 )
						);
					}
				},
			),
		)
	);

	register_rest_route( self::route_namespace,
		'/contact-forms/(?P<id>\d+)/feedback',
		array(
			'args' => $this->get_argument_schema(),
			array(
				'methods' => WP_REST_Server::CREATABLE,
				'callback' => array( $this, 'create_feedback' ),
				'permission_callback' => '__return_true',
			),
		)
	);

	register_rest_route( self::route_namespace,
		'/contact-forms/(?P<id>\d+)/refill',
		array(
			'args' => $this->get_argument_schema(),
			array(
				'methods' => WP_REST_Server::READABLE,
				'callback' => array( $this, 'get_refill' ),
				'permission_callback' => '__return_true',
			),
		)
	);
}