• The Save changes button does not work and I get the following stack trace:

    Uncaught TypeError: Unable to convert object of type 'function' to json.
    $.toJSON @ jquery.json.js?ver=1450275256:102
    $.toJSON @ jquery.json.js?ver=1450275256:118
    $.toJSON @ jquery.json.js?ver=1450275256:118
    encodeMenuAsJSON @ menu-editor.js?ver=1450275256:1647
    (anonymous function) @ menu-editor.js?ver=1450275256:4026
    m.event.dispatch @ load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils,jquery-ui-core,jquery-ui-widget,jquery…:4
    r.handle @ load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils,jquery-ui-core,jquery-ui-widget,jquery…:4

    https://wordpress.org/plugins/admin-menu-editor/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Janis Elsts

    (@whiteshadow)

    I can’t seem to reproduce that error. Are you using the latest version of the plugin? Give the development version a try.

    Thread Starter figassis

    (@figassis)

    Just tried, issue remains. The error is saying that you cannot convert a function to JSON.

    The stack trace shows that the tree object contains a function when it’s passed to the encodeMenuAsJSON function, so the $.toJSON(tree); statement throws an error.

    If you do a console.log(tree); inside the encodeMenuAsJSON, you’ll see that the tree object has a color_presets object containing a function called remove.

    In the readMenuTreeState function definition, line 1692, if you comment out the color presets attribute, the save button works fine.

    return {
    tree: tree,
    //color_presets: $.extend(true, {}, colorPresets),
    granted_capabilities: AmeCapabilityManager.getGrantedCapabilities()
    };

    This should give a hint on how to solve the issue.

    Plugin Author Janis Elsts

    (@whiteshadow)

    If you do a console.log(tree); inside the encodeMenuAsJSON, you’ll see that the tree object has a color_presets object containing a function called remove.

    I’ve done that and the color_presets object doesn’t have a remove function. It doesn’t have any functions.

    Are you sure one of your other plugins isn’t messing with the loaded libraries (e.g. by loading an incompatible version of jQuery or Lodash) or adding extra functions to the Object prototype? Try temporarily deactivating any plugins that add JS to all admin pages and see if the problem goes away.

    i ll use it

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Cannot Save Menu changes’ is closed to new replies.