{"id":16884669,"date":"2023-07-10T19:15:26","date_gmt":"2023-07-10T19:15:26","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/modify-form-with-php\/"},"modified":"2023-07-10T19:15:26","modified_gmt":"2023-07-10T19:15:26","slug":"modify-form-with-php","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/modify-form-with-php\/","title":{"rendered":"Modify form with PHP"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Dear all,,<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I well understand that Ninja Forms support does not address code issue.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I post here in case of the Ninja Forms community could help me. \ud83d\ude42<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I am trying to create and modify forms with PHP.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Creating an empty form with this code works well (the new form appears in the admin panel):<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">https:\/\/developer.ninjaforms.com\/codex\/forms\/<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\n\n\/*\n * Create a Form\n *\/\n \n$form = Ninja_Forms()-&gt;form()-&gt;get();\n\n$form-&gt;update_setting( 'title', 'Contact Me' );\n\n$form-&gt;save();<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Nevertheless, I am trying to add a field in an existing form with this code and I am not able to make it work&#8230; :<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">https:\/\/developer.ninjaforms.com\/codex\/fields\/<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/*\n * Create a Field\n *\/\n \n$field = Ninja_Forms()-&gt;form( 12 )-&gt;field()-&gt;get();\n\n$field-&gt;update_settings( 'type', 'textbox' )-&gt;save();<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Can anyone tell me what I am doing wrong ?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thank you<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Xerviami<\/p>\n","protected":false},"template":"","class_list":["post-16884669","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/16884669","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/16884669\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=16884669"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}