Support » Fixing WordPress » wplink inputs fields not being created

  • Hello there, I hope you are doing well!

    I have one problem with wplink feature (file wp-includes/js/wplink.js)

    So I am creating a plugin where on button click modal opens and you choose link for input field (standard wplink feature).

    I have created new wp-menu-item where that button is located. When I click a button I get error :

    TypeError: p.url.val(...) is undefined   wplink.min.js:1:3051
    TypeError: p.url[0] is undefined   wplink.min.js:1:2962

    After unminfying wplink file I get error:

    TypeError: inputs.url.val(...) is undefined   wplink.min.js:200:30
    TypeError: inputs.url[0] is undefined   wplink.min.js:190:6 

    So basically inputs.url[0] doesn’t exist. After little bit more debugging I have found out that this works normally on posts/pages but doesn’t work in this custom menu.

    Object in posts/pages looks like:

    url: {…}
    ​0: <input id="wp-link-url" type="text" aria-describedby="wplink-enter-url">​​
    context: HTMLDocument http://
    length: 1
    selector: "#wp-link-url"
    <prototype>: {…
    
    and in custom menu it looks like
    url: {…}
    context: HTMLDocument http://
    ​selector: "#wp-link-url"
    ​​<prototype>: {…

    So this inputs.url[0] is definitely missing. After a little more checks noticed that all inputs.ObjectKey[0] are missing on this custom menu page (inputs.close[0], inputs.dialog[0], inputs.text[0], etc) but are present on normal pages/posts.

    Could someone please give me some idea how to overcome this and actually be able to use wplink.

    Thank you for your time!

    • This topic was modified 3 weeks, 6 days ago by Steve Stern.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.