Skip Navigation

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

This support ticket is created 2 years, 5 months ago. There's a good chance that you are reading advice that it now obsolete.

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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 1 reply, has 2 voices.

Last updated by Waqar 2 years, 5 months ago.

Assisted by: 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

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