Filter acf_tablefield/get_table/attr/table
This filter is used in get_table()
or other table HTML returning functions and methodes and enables to filter/add/remove attributes and their values of the <table>
element.
Parameters
add_filter( 'acf_tablefield/get_table/attr/table', function( $attr, $data ) {
$attr['border'] = '0';
$attr['class'][] = 'highlighted';
$attr['style'][] = 'width: 50%;';
return $attr;
}, 10, 2 );
-
$attr
A key value pair array of the html element attributes.
-
$data['field']
ACF field oject
-
$data['selector']
Field name or key
-
$data['post_id']
The post ID
-
$data['table_data']
The data of the table
-
$data['manager_id']
The table manager id if set.
Result
<table border="0" class="highlighted" style="width: 50%;"></table>