Is it possible to setup one add_settings_field() in an options backend and then use jQuery clone function on the front end and be able to create multiples of whatever and save that in an array?

I've been doing countless research with no luck, wondering if it is even possible.


jQuery can only clone what is on the current page or what is loaded over AJAX, so setting something up on the backend and cloning it on the front is not possible. What you can do is create a string and print to the front as a Javascript variable or as a hidden div that you can then clone with jQuery. WordPress does this on the backend if you look near the top of any backend page. For example:

function tst() {
    echo '<script type="text/javascript">var hello="hi";</script>';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.