custom.php
6 years ago
email.php
6 years ago
option.php
6 years ago
post.php
6 years ago
term.php
6 years ago
user.php
6 years ago
custom.php
38 lines
| 1 | <?php |
| 2 | |
| 3 | if(!defined('ABSPATH')) |
| 4 | exit; |
| 5 | |
| 6 | if(!class_exists('acfe_form_custom')): |
| 7 | |
| 8 | class acfe_form_custom{ |
| 9 | |
| 10 | function __construct(){ |
| 11 | |
| 12 | add_filter('acf/validate_value/name=acfe_form_custom_action', array($this, 'validate'), 10, 4); |
| 13 | |
| 14 | } |
| 15 | |
| 16 | function validate($valid, $value, $field, $input){ |
| 17 | |
| 18 | if(!$valid) |
| 19 | return $valid; |
| 20 | |
| 21 | $reserved = array( |
| 22 | 'custom', |
| 23 | 'email', |
| 24 | 'post', |
| 25 | 'term', |
| 26 | ); |
| 27 | |
| 28 | if(in_array($value, $reserved)) |
| 29 | $valid = 'This action name is not authorized'; |
| 30 | |
| 31 | return $valid; |
| 32 | } |
| 33 | |
| 34 | } |
| 35 | |
| 36 | new acfe_form_custom(); |
| 37 | |
| 38 | endif; |