HI,
so I’ve exported products to external service, but it took the product descriptions with WPbakery shortcodes. I’ve found out how to change the Rest Api to replace the WPbakery shortcodes with div classess(belowe). Which works fine on my local environment but uploading it to server doesn’t do any changes. Is there something to update in the theme ?
//Remove WPBakery tags from API
add_action( 'rest_api_init', function ()
{
register_rest_field(
'product',
'description',
array(
'get_callback' => 'htr_do_shortcodes',
'update_callback' => null,
'schema' => null,
)
);
});
function htr_do_shortcodes( $object, $field_name, $request )
{
WPBMap::addAllMappedShortcodes();
global $post;
$post = get_post ($object['id']);
$output['rendered'] = apply_filters( 'the_content', $post->post_content );
return $output;
}
Attachments:
You must be
logged in to view attached files.