Noptin_Form::create( $status = false )
Creates a new form
Return Return
(mixed) True on success. WP_Error on failure
Source Source
File: includes/class-noptin-form.php
public function create( $status = false ) { // Prepare the args... $args = $this->get_post_array(); unset( $args['ID'] ); if ( ! empty( $status ) ) { $args['post_status'] = $status; } // ... then create the form. $id = wp_insert_post( $args, true ); // If an error occured, return it. if ( is_wp_error( $id ) ) { return $id; } // Set the new id. $this->id = $id; $this->data['id'] = $id; $state = $this->data; unset( $state['optinHTML'] ); unset( $state['optinType'] ); unset( $state['id'] ); update_post_meta( $id, '_noptin_state', $this->data ); update_post_meta( $id, '_noptin_optin_type', $this->optinType ); return true; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
1.0.5 | Introduced. |