'GET', 'callback' => __NAMESPACE__ . '\\get_ad_types', 'permission_callback' => function () { return current_user_can( 'edit_posts' ); }, ] ); } ); /** * REST callback returning ad types. * * @param \WP_REST_Request $request * @return \WP_REST_Response */ function get_ad_types( \WP_REST_Request $request ) { $types = \AdVajra\Core\AdTypes::get_types(); return rest_ensure_response( $types ); }