Home › Forums › Front-end Issues › Embed video youtube frontend?
How to embed video youtube from frontend with acf_form()?
I have used add media in field wysiwyg, but can not embed video.
Thanks all!
Hi @ngtrian
Embedding a youtube video in WordPress is as simple as just pasting in the link to the video in your editor. There’s also a oembed specific field type in ACF if you want the frontend form to just have a single inputfield specifically for a youtube link (or any other oembed compatible url like twitter, vimeo etc)
I think I’ve got the same problem as ngtrian.
Somehow I’m not able to embed a video in a front-end form.
In the back-end it works fine, but in the front-end it shows the link.
Ive also tried it by clicking the “Add Media” button, but in this case it shows the link within the [embed] [/embed] tags.
Is there something that I’m missing with creating the acf-form?
I’m using the following code:
$options = array(
/* (int|string) The post ID to load data from and save data to. Defaults to the current post ID.
Can also be set to 'new_post' to create a new post on submit */
'post_id' => 'new_post',
'form_attributes' => array( // attributes will be added to the form element
'class' => ''
),
/* (array) An array of post data used to create a post. See wp_insert_post for available parameters.
The above 'post_id' setting must contain a value of 'new_post' */
'new_post' => array(
'post_type' => 'odin_page', // This is my own created post type.
'post_status' => 'publish'
),
/* (boolean) Whether or not to show the post title text field. Defaults to false */
'post_title' => true,
/* (boolean) Whether or not to show the post content editor field. Defaults to false */
'post_content' => true,
/* (boolean) Whether or not to create a form element. Useful when a adding to an existing form. Defaults to true */
'form' => false
);
acf_form($options);
Thanks for your help!
Tim
Hi @timm
I think what’s happening here is that since WordPress does not load the automatic oembed detection/conversion scripts in frontend you wont see the “transformed” video from pasting an URL.
I’ll assign @elliot to this issue to see if there’s anything that can be done.
He’s rather busy tho so it might take a while to get a response.
I am having a similar issue I created my front end form with Formidable but I have to manually go in and edit every entry for the video to display, otherwise only the link displays
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.