- This topic has 2 replies, 2 voices, and was last updated 5 years, 11 months ago by
jivedig.
-
AuthorPosts
-
-
January 31, 2016 at 3:12 pm #5805
kattagamiMemberHello,
I try to update a CPT with a front end form.
I call my form with an URL like this:
http://xxx.com/my-form/?action=presentation&_post[ID]=57And this is the code from my form file:
<?php /* Method: post */ piklist( 'field', array( 'type' => 'hidden', 'scope' => 'post', 'field' => 'post_type', 'value' => 'presentation', ) ); piklist( 'field', array( 'type' => 'text', 'scope' => 'post', 'field' => 'post_title', 'label' => esc_html__( 'Title' , 'katt' ), ) ); piklist( 'field', array( 'type' => 'textarea', 'scope' => 'post', 'field' => 'post_content', 'label' => esc_html__( 'Content' , 'katt' ), 'attributes' => array( 'rows' => 10, 'cols' => 50, 'class' => 'katt-proposition-content', ) ) ); piklist( 'field', array( 'type' => 'submit', 'field' => 'submit', 'value' => esc_html__( 'Submit' , 'katt' ), 'attributes' => array( 'class' => 'button button-primary', ) ) );1- My inputs form are empty and not populated by the id=57 “presentation” CPT data.
Do I need to do it myself with a get_post_type($args) function or Piklist is supposed to do it itself?
If I put some content in the (empty) fields and submit the form, my id=57 CPT is updated. However, the front end input fields remain empty.2- Have got some warning messages on each fields (Mode debug > true)
Warning: Illegal string offset ‘field’ in /xxx/wp-content/plugins/piklist/includes/class-piklist-form.php on line 926See my screenshot
Attachments:
You must be logged in to view attached files. -
February 1, 2016 at 6:55 am #5814
kattagamiMemberTypo in my previous message:
“Do I need to do it myself with a get_post($ID) function …”
-
March 11, 2016 at 10:55 pm #6067
jivedigMemberI don’t think you need the cpt name in the query string. WP uses unique ID’s regardless of post_type. I have this working with just ?_post[ID]=57 on a CPT.
-
-
AuthorPosts
- The topic ‘Front end form, update a CPT’ is closed to new replies.