Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to allow shortcodes in add-on field descriptions
<?php
/**
* Allow shortcodes in field description
*/
function prefix_shortcode_in_description( $description, $item, $additional_info='' ) {
$field_description = ! empty( $item['field_description'] ) ? $item['field_description'] : '';
$description = sprintf(
'<p class="pewc-description">%s%s</p>',
do_shortcode( $field_description ),
$additional_info
);
return $description;
}
add_filter( 'pewc_filter_field_description', 'prefix_shortcode_in_description', 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment