No Media Embeds for non-loggedin users on front-end form
-
My site offers a front end form for creating draft content, it accepts a title, an uploaded image, and then a tiny-mce editor for the content (yes I know the issues of anyone can post, this is for a private site)
I’m a bit baffled as if I am logged in, and I use the form, then all media URLs (YouTube, twitter, eyc) that normally autoembed in the editor do so on my forms. Perfectly.
If I am not logged in, nothing gets embedded. My pages are properly enqueuing mce-view:
if (! is_admin() ) wp_enqueue_media(); // Autoembed functionality in rich text editor // needs dependency on tiny_mce // h/t https://wordpress.stackexchange.com/a/287623 wp_enqueue_script( 'mce-view', '', array('tiny_mce') );
In viewing the load sequence in Chrome inspector, when logged in and the autoembed works, there is a call to admin_ajax.php — this of course will fail when not logged in, and this is my best guess as to why it’s not working.
I know from research that to enable ajax calls that seem to be needed I need to have an action set up like
wp_ajax_nopriv_{action}
(I in fact do this successfully for the dropzone.js integration since I wrote the functions that are called back by ajax).But I have no idea what callbacks are needed to be granted
wp_ajax_nopriv_{action}
these are not my functions but from internal WordPress code for doing oembeds.So (a) is it even possible to enable auto embeds of media on a front end editor w/o a login and/or (b) how to I grant access to admin-ajax.php if there is no login?
The page I need help with: [log in to see the link]
- The topic ‘No Media Embeds for non-loggedin users on front-end form’ is closed to new replies.