I want to create my own code for displaying and editing a logged in user's profile.
For that I want to create a form inside a Wordpress page and pre-populate the form fields with data before the page is displayed. I want to do this independently of any plugin providing form widgets. This raises the following questions for me:
Is there a general form and form data handling mechanism in Wordpress that I can facilitate for this, like e.g. Wordpress has a form object containing a "field" or data object for each of the form's fields, allowing me to access the form(s) on a page?
I actually wouldn't even need a form object. Instead, I could just place a couple of input fields on the page. How would I access these in some php function?
How would I access the forms (is there e.g. a Wordpress function receiving the form name and returning me a form object?)
How would I intercept loading of the page containing the form(s) (or any page, that is) before it gets rendered, but after the form object is instantiated/initialized?
As I said, I am not looking for a particular form implementation by e.g. some plugin, but whether there is a general underlying mechanism, which might eventually be utilized by such plugins, I could facilitate.
I want to create my own code for displaying and editing a logged in user's profile.
For that I want to create a form inside a Wordpress page and pre-populate the form fields with data before the page is displayed. I want to do this independently of any plugin providing form widgets. This raises the following questions for me:
Is there a general form and form data handling mechanism in Wordpress that I can facilitate for this, like e.g. Wordpress has a form object containing a "field" or data object for each of the form's fields, allowing me to access the form(s) on a page?
I actually wouldn't even need a form object. Instead, I could just place a couple of input fields on the page. How would I access these in some php function?
How would I access the forms (is there e.g. a Wordpress function receiving the form name and returning me a form object?)
How would I intercept loading of the page containing the form(s) (or any page, that is) before it gets rendered, but after the form object is instantiated/initialized?
As I said, I am not looking for a particular form implementation by e.g. some plugin, but whether there is a general underlying mechanism, which might eventually be utilized by such plugins, I could facilitate.
Share Improve this question edited Jun 8, 2021 at 18:00 vancoder 7,92428 silver badges35 bronze badges asked Jun 8, 2021 at 15:08 RazzupaltuffRazzupaltuff 1396 bronze badges1 Answer
Reset to default 1Is there a general form and form data handling mechanism in Wordpress that I can facilitate for this, like e.g. Wordpress has a form object containing a "field" or data object for each of the form's fields, allowing me to access the form(s) on a page?
No, there is not.
I actually wouldn't even need a form object. Instead, I could just place a couple of input fields on the page. How would I access these in some php function?
The same way any other PHP/HTML application would. WordPress does not provide a form API.
How would I access the forms (is there e.g. a Wordpress function receiving the form name and returning me a form object?)
How would I intercept loading of the page containing the form(s) (or any page, that is) before it gets rendered, but after the form object is instantiated/initialized?
You don't, there are no form APIs or objects in WordPress, that is not a feature WordPress implements.
As I said, I am not looking for a particular form implementation by e.g. some plugin, but whether there is a general underlying mechanism, which might eventually be utilized by such plugins, I could facilitate.
No such mechanism exists. Each form plugin builds their form system from scratch. Some use custom tables to store the data, some use custom post types, but there is no generic system that sits underneath them. You would have to build it yourself or use a 3rd party plugin/library to provide it.