Filtersacf_tablefield/ajax_capabilityPHPRelease Candidate1.8.0
ajax capability permission nonce
Since version: v1.8.0
Filter acf_tablefield/ajax_capability
This filter sets the capability a user needs for the AJAX requests of the table editor. Every request is first checked with a nonce. If the filter returns a capability, the user must also have it. Otherwise the request is rejected with the HTTP status 403 and a JSON error.
Parameters
add_filter( 'acf_tablefield/ajax_capability', function( $capability, $action ) {
if ( 'render_content' === $action ) {
return 'edit_others_posts';
}
return $capability;
}, 10, 2 );
-
$capabilityThe capability the user needs, or
falsefor no capability check. Only a non-empty string is checked withcurrent_user_can().
-
$actionThe AJAX request that is checked.
- Options:
render_content,wp_editor,cache_overlay_field_value
AJAX requests
| Action | Default | Description |
|---|---|---|
render_content
|
false
|
Renders shortcodes in table cells for the preview in the table editor. |
wp_editor
|
false
|
Loads the WYSIWYG editor of a table cell. |
cache_overlay_field_value
|
edit_posts
|
Saves settings of the table options modal site-wide for the next use, such as the import source. |