Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

Registration fields prefilled with URL parameters

Give this code a try:

var query = window.location.search.substring(1);

var paramList = query.split('&');

for (var i=0; i < paramList.length; i++)
{
    var param = paramList[i].split('=');

    if(param[0] == 'email')
    {
        var element = document.getElementById('user_login');

        if (element)
        {
            element.value = decodeURIComponent(param[1]);
        }
    }
}

I used the browser inspector console to test it out quickly and debug it — there was an error in the syntax (a missing parenthesis) and user_email needed to be user_login. It’s a great tool if you aren’t familiar with it and can speed up the time it takes to write JS. Also, element.value was the key to changing the field.

Incidentally, you don’t need this line:

add_action('login_enqueue_scripts', 'is_wplogin');

… in fact, it doesn’t do anything! prefillercheck calls is_wplogin directly.

Related Posts:

  1. “Password Strength Unknown” Registration Issue
  2. Javascript on Registration Page
  3. How can I generate a rainbow circle using HTML5 canvas?
  4. What’s the difference between “{}” and “[]” while declaring a JavaScript array?
  5. What does “javascript:void(0)” mean?
  6. For-each over an array in JavaScript
  7. How to delete a cookie?
  8. What is TypeScript and why would I use it in place of JavaScript? [closed]
  9. How do you use the ? : (conditional) operator in JavaScript?
  10. Which equals operator (== vs ===) should be used in JavaScript comparisons?
  11. are there dictionaries in javascript like python?
  12. How to do associative array/hashing in JavaScript
  13. How to make a discord bot create an invite for every server it joins?
  14. ES6 Map in Typescript
  15. addEventListener vs onclick
  16. “Uncaught SyntaxError: Cannot use import statement outside a module” when importing ECMAScript 6
  17. How do I check if an array includes a value in JavaScript?
  18. JavaScript document.getElementById().value logs empty value
  19. How do I color a hexagonal grid such that it doesn’t have neighbors of the same color?
  20. How to format a JavaScript date
  21. What does href expression do?
  22. map function for objects (instead of arrays)
  23. Wait 5 seconds before executing next line
  24. Failed to load resource: the server responded with a status of 404 (Not Found)
  25. How to check whether a string contains a substring in JavaScript?
  26. Check if a string has a certain piece of text [duplicate]
  27. Kadane’s algorithm explained
  28. What is console.log?
  29. Dynamically creating charts of each row in an HTML table with chart.js
  30. Failed to load resource: the server responded with a status of 404 (Not Found)
  31. How to convert a string to an integer in JavaScript?
  32. Maximum call stack size exceeded error
  33. How to change CSS using jQuery?
  34. How to properly use jsPDF library
  35. How to reload a page using JavaScript
  36. How can I do string interpolation in JavaScript?
  37. Can I use complex HTML with Twitter Bootstrap’s Tooltip?
  38. Start script missing error when running npm start
  39. How do I redirect to another webpage?
  40. How to round to at most 2 decimal places, if necessary?
  41. What is VanillaJS?
  42. Invariant Violation: Objects are not valid as a React child
  43. How do I make the first letter of a string uppercase in JavaScript?
  44. How to handle Uncaught (in promise) DOMException: The play() request was interrupted by a call to pause()
  45. window.location.href and window.open () methods in JavaScript
  46. Invariant Violation: Objects are not valid as a React child
  47. What’s the difference between using “let” and “var”?
  48. Angular: conditional class with *ngClass
  49. How do I make the first letter of a string uppercase in JavaScript?
  50. Loop through an array in JavaScript
  51. How to format a JavaScript date
  52. What does this symbol () => mean in Javascript? [duplicate]
  53. How do I redirect to another webpage?
  54. Google reCAPTCHA V3.0 not working. “ERROR for site owner: Invalid key type”
  55. How to round to at most 2 decimal places, if necessary?
  56. Google Chrome Uncaught (in promise) DOMException while playing AUDIO
  57. Define a global variable in a JavaScript function
  58. “SyntaxError: Unexpected token < in JSON at position 0"
  59. How to add a class to a given element?
  60. Can’t bind to ‘ngModel’ since it isn’t a known property of ‘input’
  61. Javascript split regex question
  62. Cross-Origin Read Blocking (CORB)
  63. What is Virtual DOM?
  64. How can I remove a specific item from an array?
  65. How can a Discord bot create a hyperlink in a Discord message in an embed or in general? [closed]
  66. Find object by id in an array of JavaScript objects
  67. jQuery append() vs appendChild()
  68. How can I access and process nested objects, arrays or JSON?
  69. How to you store data for each discord user in the discord server?
  70. How to get all place details from a Place Details Request using Google Places API Web Service?
  71. How to make a word underline in Markdown
  72. Cannot set property ‘innerHTML’ of null
  73. Creating multiline strings in JavaScript
  74. How to replace innerHTML of a div using jQuery?
  75. SyntaxError: Unexpected token o in JSON at position 1
  76. Uncaught ReferenceError: $ is not defined?
  77. Cannot read property ‘addEventListener’ of null
  78. Uncaught ReferenceError: jQuery is not defined [duplicate]
  79. ChartJS beginAtZero, min, max doesn’t work
  80. How do I check whether a checkbox is checked in jQuery?
  81. Babel 6 regeneratorRuntime is not defined
  82. How to use Redirect in the new react-router-dom of Reactjs
  83. syntax error: unexpected token <
  84. How to define type for a function callback (as any function type, not universal any) used in a method parameter
  85. how to fix : ” TypeError: Cannot read property ‘addEventListener’ of null”…?//
  86. Cannot set property InnerHTML of null [duplicate]
  87. Error OPTIONS net::ERR_CONNECTION_REFUSED
  88. SyntaxError: Unexpected token o in JSON at position 1
  89. What is JSONP, and why was it created?
  90. TypeError: Converting circular structure to JSON in nodejs
  91. ReferenceError: $ is not defined
  92. How to fix “Cannot read property ‘addEventListener’ of null” error [duplicate]
  93. Uncaught ReferenceError: jQuery is not defined [duplicate]
  94. React.js: Set innerHTML vs dangerouslySetInnerHTML
  95. What does [object Object] mean?
  96. What does the function then() mean in JavaScript?
  97. Remove class using jQuery
  98. How do I check whether a checkbox is checked in jQuery?
  99. Babel 7 – ReferenceError: regeneratorRuntime is not defined
  100. React – uncaught TypeError: Cannot read property ‘setState’ of undefined
Categories javascript Tags javascript, parameter, parse, user-registration, wp-login-form
Best Way To Locate Offending WP Table
comment_approved custom value

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress