LLMS_Section::get_creation_args( array $args = null )

An array of default arguments to pass to $this->create() when creating a new section


Parameters Parameters

$args

(array) (Optional) Data to be passed to wp_insert_post().

Default value: null


Top ↑

Return Return

(array)


Top ↑

Source Source

File: includes/models/model.llms.section.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,
			);
		}

		$args = wp_parse_args(
			$args,
			array(
				'comment_status' => 'closed',
				'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' ),
			)
		);

		/**
		 * Filter arguments used to create a new section post
		 *
		 * @since 4.11.0
		 *
		 * @param array        $args    Data to be passed to `wp_insert_post()`.
		 * @param LLMS_Section $section Instance of the section object.
		 */
		return apply_filters( 'llms_section_get_creation_args', $args, $this );

	}


Top ↑

Changelog Changelog

Changelog
Version Description
3.13.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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