Skip Navigation

[Resolved] Custom Field for script embed

This thread is resolved. Here is a description of the problem and solution.

Problem: I would like to allow my Users to store a small Javascript snippet in a custom field. This snippet will be used to display a Podcast widget. Which field type is best for storing JavaScript code?

Solution: A multiple lines field type (also known as textarea) is best for storing custom code snippets like this. To enable script tags in Forms, refer to the following example.

Relevant Documentation:
https://toolset.com/documentation/customizing-sites-using-php/functions/#textarea
https://toolset.com/forums/topic/cred-corrupting-data/

This support ticket is created 3 years, 11 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 2 replies, has 2 voices.

Last updated by stewartE 3 years, 11 months ago.

Assisted by: Christian Cox.

Author
Posts
#1979641
podcast.PNG
buzz.PNG

I have created a CPT called Podcasts it has a title, body and excerpt I also want to embed an actual Podcast which is hosted on Buzzsprout. To do this I need to paste in a small embed code provided by buzzsprout. Would you be able to advise me which is the best custom field to use to achieve something like this?

Thanks!

#1979883

Hi, it is usually best to use the Multiple lines field type to include custom code with script tags. Script tags are a security risk, and are stripped out of custom field values automatically when content is submitted with Toolset Forms. Do you plan to create these posts in wp-admin, or will they be created from the front-end of the site using Forms?

#1981857

My issue is resolved now. Thank you!