wp_protected_ajax_actions
Filter HookDescription
Filters the array of protected Ajax actions. This filter is only fired when doing Ajax and the Ajax request has an 'action' property.Hook Information
File Location |
wp-includes/load.php
View on GitHub
|
Hook Type | Filter |
Line Number | 1244 |
Hook Parameters
Type | Name | Description |
---|---|---|
string[]
|
$actions_to_protect
|
Array of strings with Ajax actions to protect. |
Usage Examples
Basic Usage
<?php
// Hook into wp_protected_ajax_actions
add_filter('wp_protected_ajax_actions', 'my_custom_filter', 10, 1);
function my_custom_filter($actions_to_protect) {
// Your custom filtering logic here
return $actions_to_protect;
}
Source Code Context
wp-includes/load.php:1244
- How this hook is used in WordPress core
<?php
1239 *
1240 * @since 5.2.0
1241 *
1242 * @param string[] $actions_to_protect Array of strings with Ajax actions to protect.
1243 */
1244 $actions_to_protect = (array) apply_filters( 'wp_protected_ajax_actions', $actions_to_protect );
1245
1246 if ( ! in_array( $_REQUEST['action'], $actions_to_protect, true ) ) {
1247 return false;
1248 }
1249
PHP Documentation
<?php
/**
* Filters the array of protected Ajax actions.
*
* This filter is only fired when doing Ajax and the Ajax request has an 'action' property.
*
* @since 5.2.0
*
* @param string[] $actions_to_protect Array of strings with Ajax actions to protect.
*/
Quick Info
- Hook Type: Filter
- Parameters: 1
- File: wp-includes/load.php
Related Hooks
Related hooks will be displayed here in future updates.