Embed an code use Custom_field
-
Hello Jeff Starr,
I’m creating a form that allows the user to enter an iframe code from an external page.
I added a “Custom Field” to the submit form. Name of the custom field: “code ” and the lable: ” Iframe Code “.
Im tried to enter an Iframe code from Youtube and hit Submit buttom, I got error: “Error: iframe code required“. So can USP submit an Iframe code ? If yes, Whats wrong with my option and how can I fix it?
Thank you so much.
-
Hi, glad to help. The plugin uses WP’s
wp_kses_allowed_html('post')when filtering the custom field content. By default, dangerous stuff like<script>,<iframe>, and so forth are removed. Basically removes tags and attributes that you don’t want random people adding to post content.To override the default WP functionality for USP, you or a developer would need to use the
usp_content_allowedhook. Here is the context, inuser-submitted-posts.php:$allowed_tags = apply_filters('usp_content_allowed', $allowed_tags);That would enable custom code to add iframe or whatever tags are necessary to the array of allowed tags.
-
This reply was modified 8 years, 4 months ago by
Jeff Starr.
Hello Jeff Starr,
Thank you for supporting me.
Well, I’m not a website programmer so its hard.
I added all iframe tags/attributes to $allowedtags and the $allowedposttags on Kses.php
For now, I can submit iframe code and play it too. Its working fine. 😀
:/ But I wonder if I did the right steps?-
This reply was modified 8 years, 4 months ago by
bebiggerboy.
-
This reply was modified 8 years, 4 months ago by
bebiggerboy.
Awesome glad you got it sorted. Make sure to follow the WP API and you should be fine. If in doubt, hire a professional to review your code for you, just to be 100% sure.
Yes. Thank you so much! I’ll purchase for the PRO version. Good bye.
Love you. -
This reply was modified 8 years, 4 months ago by
The topic ‘Embed an code use Custom_field’ is closed to new replies.