ACF_REST_Ability.php
5 months ago
Abilities.php
5 months ago
AbstractAbilityGroup.php
5 months ago
FieldGroup.php
3 months ago
PostType.php
5 months ago
Taxonomy.php
3 months ago
ACF_REST_Ability.php
43 lines
| 1 | <?php |
| 2 | /** |
| 3 | * @package ACF |
| 4 | * @author WP Engine |
| 5 | * |
| 6 | * © 2026 Advanced Custom Fields (ACF®). All rights reserved. |
| 7 | * "ACF" is a trademark of WP Engine. |
| 8 | * Licensed under the GNU General Public License v2 or later. |
| 9 | * https://www.gnu.org/licenses/gpl-2.0.html |
| 10 | */ |
| 11 | |
| 12 | namespace ACF\AI\Abilities; |
| 13 | |
| 14 | use WP_Ability; |
| 15 | |
| 16 | // Exit if accessed directly. |
| 17 | defined( 'ABSPATH' ) || exit; |
| 18 | |
| 19 | /** |
| 20 | * ACF REST Ability |
| 21 | * |
| 22 | * Custom ability class that extends WP_Ability to skip output validation. |
| 23 | * This is needed because REST API schemas don't always match Abilities API schemas exactly, |
| 24 | * but we want to proxy directly to REST API endpoints. |
| 25 | */ |
| 26 | class ACF_REST_Ability extends WP_Ability { |
| 27 | |
| 28 | /** |
| 29 | * Override validate_output to always return true. |
| 30 | * |
| 31 | * Since we're proxying to WordPress REST API endpoints that have their own |
| 32 | * validation, we trust their output and skip Abilities API output validation. |
| 33 | * |
| 34 | * @since 6.8.0 |
| 35 | * |
| 36 | * @param mixed $output The output to validate. |
| 37 | * @return true Always returns true to skip validation. |
| 38 | */ |
| 39 | protected function validate_output( $output ) { |
| 40 | return true; |
| 41 | } |
| 42 | } |
| 43 |