Skip Navigation

[Resolved] Getting error when saving content template with shortcode element inside

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 1 reply, has 2 voices.

Last updated by Waqar 1 month, 2 weeks ago.

Assigned support staff: Waqar.

Author
Posts
#2434523

I am trying to:

Here is a video about what I am trying to do and the error I am getting hidden link

Link to a page where the issue can be seen:

hidden link

I expected to see:

The expectation is to be able to save this content template without any issue or error!

Instead, I got:

I am getting this error message: Updating failed. Unexpected token '<', "<div class"... is not valid JSON

#2434851

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting us and I'd be happy to assist.

I noticed that the "wdm_my_subscription" custom shortcode was returning its output much sooner when the content template editor screen was getting loaded, which was breaking the page's markup.

I've updated the shortcode's code to get the output as an object first and then return it, which seems to have fixed it:


add_shortcode('wdm_my_subscription', 'wmd_my_custom_function');
function wmd_my_custom_function(){
	ob_start();
	WCS_Template_Loader::get_my_subscriptions();
	return ob_get_clean();
}

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar