Since version: v1.8.0
Filter acf_tablefield/formatting/inline_styles
This filter decides whether the formatting is also output as style attributes of the cells. This is for output that has no access to the stylesheet of the plugin, for example feeds, e-mails or PDF generators. By default it is on for feeds and off everywhere else.
The attribute data-acftf-format stays in the output. The style attribute is added to the cells that have formatting, with the properties vertical-align, text-align, font-weight, font-style, text-decoration, text-transform, font-size, white-space and font-variant. Text decoration and numbers use text-decoration and font-variant and not the longer properties text-decoration-line and font-variant-numeric, because WordPress removes them from attributes. No wrap always applies, there is no minimum width, see acf_tablefield/formatting/nowrap_min_width.
Parameters
add_filter( 'acf_tablefield/formatting/inline_styles', function( $enabled, $field, $post_id ) {
// inline styles for all tables, not only in feeds
return true;
}, 10, 3 );
-
$enabledWhether to output inline styles. Default
is_feed().
-
$fieldThe ACF field.
nullif the table is output from raw table data without a field.
-
$post_idThe post ID as passed to
get_table(),falsefor the current post.
Result
<td data-acftf-format="fw-700" style="font-weight: 700"></td>
Turn on for one call
add_filter( 'acf_tablefield/formatting/inline_styles', '__return_true' );
$html = get_table( 'my_table', $post_id );
remove_filter( 'acf_tablefield/formatting/inline_styles', '__return_true' );