Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

LLMS_Post_Model::create( string $title = '' )

Create a new post of the Instantiated Model


Description Description

This can be called by instantiating an instance with "new" as the value passed to the constructor.


Top ↑

Parameters Parameters

$title

(string) (Optional) Title to create the post with.

Default value: ''


Top ↑

Return Return

(int) WP Post ID of the new Post on success or 0 on error.


Top ↑

Source Source

File: includes/abstracts/abstract.llms.post.model.php

	private function create( $title = '' ) {
		return wp_insert_post(
			wp_slash(
				/**
				 * Filters the creation arguments used to create a new post.
				 *
				 * The return array is passed through {@see wp_slash} and ultimately
				 * passed directly to {@see wp_insert_post}.
				 *
				 * The dynamic portion of this hook, `{$this->model_post_type}`, refers to the post
				 * model's `$model_post_type` property.
				 *
				 * @since 3.0.0
				 *
				 * @param array $creation_args An array of arguments passed.
				 */
				apply_filters(
					"llms_new_{$this->model_post_type}",
					$this->get_creation_args( $title )
				)
			),
			true
		);
	}


Top ↑

Changelog Changelog

Changelog
Version Description
3.30.3 Use wp_slash() for the post title.
3.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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