wpdatatables_allow_edit_table

Contents

Description

This filter is applied to the results of check which defines if the current user can or can’t edit the table (only for editable tables). The default logic is: if editor roles aren’t defined for the table, anyone can edit it. If they are then only the users that have one of these roles can edit it, but you can override the logic using this filter.

Usage

add_filter( 'wpdatatables_allow_edit_table', 'allow_edit_table', 10, 3 );

Parameters

  • $userCanEdit boolean
  • $editorRoles array
    Array of values.
  • $tableId integer
    ID of table from database.

Examples

// Callback function for the wpdatatables_allow_edit_table filter hook
function allow_edit_table( $userCanEdit, $editorRoles, $tableId ) { 
   // Check for specific table Id
   if ( $tableId == 1) { 
     // Your code
   } 
}

add_action( 'wpdatatables_allow_edit_table', 'allow_edit_table', 10, 3);