LLMS_Lesson::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 null.

Default value: null


Top ↑

Return Return

(array)


Top ↑

Source Source

File: includes/models/model.llms.lesson.php

225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
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,
        );
    }
 
    $post_type = $this->get( 'db_post_type' );
    $args      = wp_parse_args(
        $args,
        array(
            'comment_status' => get_default_comment_status( $post_type ),
            'ping_status'    => 'closed',
            'post_author'    => get_current_user_id(),
            'post_content'   => '',
            'post_excerpt'   => '',
            'post_status'    => 'publish',
            'post_title'     => '',
            'post_type'      => $post_type,
        )
    );
 
    /**
     * Filter the model creation args
     *
     * The dynamic portion of this hook, `$this->model_post_type`, refers to model post type.
     *
     * @since unknown
     *
     * @param array       $args   Args of data to be passed to `wp_insert_post()`.
     * @param LLMS_Lesson $lesson Instance of the LLMS_Lesson.
     */
    return apply_filters( "llms_{$this->model_post_type}_get_creation_args", $args, $this );
 
}


Top ↑

Changelog Changelog

Changelog
Version Description
6.3.0 Retrieve comment_status parameter value from the global discussion settings.
3.13.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.