LLMS_Question::get_creation_args( array $args = null )
An array of default arguments to pass to $this->create() when creating a new post
Parameters Parameters
- $args
-
(array) (Optional) Args of data to be passed to wp_insert_post.
Default value: null
Return Return
(array)
Source Source
File: includes/models/model.llms.question.php
protected function get_creation_args( $args = null ) { // Allow nothing to be passed in. if ( empty( $args ) ) { $args = array(); } // Backwards compat to original 3.0.0 format when just a title was passed in. if ( is_string( $args ) ) { $args = array( 'post_title' => $args, ); } if ( isset( $args['title'] ) ) { $args['post_title'] = $args['title']; unset( $args['title'] ); } if ( isset( $args['content'] ) ) { $args['post_content'] = $args['content']; unset( $args['content'] ); } $meta = isset( $args['meta_input'] ) ? $args['meta_input'] : array(); $props = array_diff( array_keys( $this->get_properties() ), array_keys( $this->get_post_properties() ) ); foreach ( $props as $prop ) { if ( isset( $args[ $prop ] ) ) { $meta[ $this->meta_prefix . $prop ] = $args[ $prop ]; unset( $args[ $prop ] ); } } $args['meta_input'] = wp_parse_args( $meta, $meta ); $args = wp_parse_args( $args, array( 'comment_status' => 'closed', 'meta_input' => array(), 'menu_order' => 1, 'ping_status' => 'closed', 'post_author' => get_current_user_id(), 'post_content' => '', 'post_excerpt' => '', 'post_status' => 'publish', 'post_title' => '', 'post_type' => $this->get( 'db_post_type' ), ) ); return apply_filters( "llms_{$this->model_post_type}_get_creation_args", $args, $this ); }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.16.12 | Unknown. |
3.16.0 | Introduced. |