Problem: I would like to add an HTML iframe tag to a custom field when editing a post in a front-end Form, but the content does not seem to be saved. If I add the same code in wp-admin when editing a post, it is saved as expected.
Solution: For security purposes, Forms automatically restricts certain code. To override that security feature, you must enable iframe tags with custom code. Add the following custom code in your child theme's functions.php file:
add_filter( 'wp_kses_allowed_html', 'tssupp_author_cap_filter',1,1 ); function tssupp_author_cap_filter( $allowedposttags ) { if ( !current_user_can( 'publish_posts' ) ) return $allowedposttags; // Here add tags and attributes you want to allow $allowedposttags['iframe']=array( 'align' => true, 'width' => true, 'height' => true, 'frameborder' => true, 'name' => true, 'src' => true, 'id' => true, 'class' => true, 'style' => true, 'scrolling' => true, 'marginwidth' => true, 'marginheight' => true, ); return $allowedposttags; }
That should cover most of the default iframe attributes for a Google Calendar embed, but you may need to adjust this code to support other non-default attributes individually.
Go to Toolset > Settings > Forms and click "Select allowed HTML tags". Choose all the tags you would like to allow Users to insert in a Form, including iframe tags.
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.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
This topic is split from https://toolset.com/forums/topic/types-plugin/
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 3 replies, has 2 voices.
Last updated by 3 years, 9 months ago.
Assisted by: Christian Cox.