简体   繁体   中英

call wp_enqueue_media on wordpress page

I am using a custom theme that when I access http://ec2-54-255-182-157.ap-southeast-1.compute.amazonaws.com/shop/ , it gives the error that

upload-media.js?ver=1:3 Uncaught TypeError: Cannot read property 'editor' of undefined

it happends at the code _orig_send_attachment = wp.media.editor.send.attachment;

some google search (like here https://codestag.com/how-to-use-wordpress-3-5-media-uploader-in-theme-options/ ) suggests that "Above code snippet works on post edit page only, to make it work elsewhere you need to use wp_enqueue_media(); in your theme. Thanks to daviedR for correcting me on this."

Any idea how to do call wp_enqueue_media() on this page?

it turns out to be caused by mbstring is not enabled. After run yum install php56-mbstring and restart httpd service, it works good now.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM