admin管理员组文章数量:1208155
I followed this code as below but it gives me the error "wp not defined
". I placed the code inside footer.php in my child theme and also in functions.php but both are erroneous.
(function($){
$.extend( wp.Uploader.prototype, {
success : function( file_attachment ){
console.log( file_attachment );
}
});
})(jQuery);
I followed this code as below but it gives me the error "wp not defined
". I placed the code inside footer.php in my child theme and also in functions.php but both are erroneous.
(function($){
$.extend( wp.Uploader.prototype, {
success : function( file_attachment ){
console.log( file_attachment );
}
});
})(jQuery);
Share
Improve this question
edited Feb 9, 2022 at 0:02
ratib90486
asked Feb 8, 2022 at 14:39
ratib90486ratib90486
295 bronze badges
3
|
1 Answer
Reset to default 0I solved the problem by loading the code inside footer.php of my child theme. Thanks people for all the help.
本文标签: jquerywp not defined at wpUploaderprototype
版权声明:本文标题:jquery - wp not defined at wp.Uploader.prototype 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738736435a2109578.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
wp
is not defined, because the rest of the code is missing and wasn't mentioned in the question. They only shared the parts they were having problems with – Tom J Nowell ♦ Commented Feb 8, 2022 at 16:44wp
is missing, andwp.Uploader
. The media library scripts don't get loaded on the frontend unless you make the effort to enqueue them. The Q you tried to use only has small snippets of a much larger piece of code that wasn't shared, including some PHP in a plugin or function.php file. That question cannot be used as an example of how to create an uploader on the frontend, or how to load the media library – Tom J Nowell ♦ Commented Feb 9, 2022 at 0:33