Skip to content

Upload Button Not Working in Background Field #2221

@erayalakese

Description

@erayalakese

WordPress version : 4.1.1 (yes, tried with fresh installation)
Redux version : 3.5.2 (Downloaded master.zip from GitHub repo)
Activated Plugins : Just my test plugin.
Activated Theme : Twenty Fifteen
Config File : http://paste.ubuntu.com/10812644
Support Hash : http://support.redux.io/?id=jVbmX4ozY0Ry6DiHNDlk%2BFKEjz9qI%2Bi5W4BpYBqrWQYOCC1auFr7u6OmzaPh7ccePqr4StRyhYaM4pCi8QoSGg%3D%3D

I'm trying to use Background Field but there is a problem with field_background.js file line 226.

 frame = wp.media(

This line causing

Uncaught TypeError: undefined is not a function

error. There is no 404 error on Chrome Developer Tools. So all js files included to page.

UPDATE 1 :

I've tried inspecting wp object so typed console.log(wp); after use strict; line in fields_background.js file . This is the result :

 Object {
      svgPainter: Object, 
      heartbeat: Object
     __proto__: Object
 }

And tried this if() control to find if media() function is exists or not (source)

 if (typeof wp.media !== 'undefined' && $.isFunction(wp.media)) {
     alert("exist");
 }else{
     alert("not exist");
 }

Result : not exist

UPDATE 2 Pull Request

Found a solution !
After a Google research, I found this . And called wp_enqueue_media() function inside admin_enqueue_scripts hook in my plugin. Now Upload button is working. I think that problem because of Redux isn't calling wp_enqueue_media() function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions