CPTPersistence
in package

Table of Contents

$postType  : mixed
__construct()  : mixed
_customizeGetPostsDistinct()  : string
_customizeGetPostsJoin()  : string
_customizeGetPostsWhere()  : mixed
convertToIdTitleList()  : array<string|int, mixed>
create()  : int
Insert Post to DB
createOrUpdate()  : int
delete()  : int
getCount()  : int
getIdTitleList()  : mixed
getPost()  : mixed
getPosts()  : mixed
update()  : int
addGetPostsFilters()  : mixed
getDefaultQueryAtts()  : array<string|int, mixed>
modifyQueryAtts()  : array<string|int, mixed>
removeGetPostsFilters()  : mixed
updatePostRelatedData()  : mixed

Properties

$postType

protected mixed $postType

Methods

__construct()

public __construct(mixed $postType) : mixed
Parameters
$postType : mixed
Return values
mixed

_customizeGetPostsDistinct()

public _customizeGetPostsDistinct(string $distinct, WP_Query $wp_query) : string
Parameters
$distinct : string
$wp_query : WP_Query
Return values
string

_customizeGetPostsJoin()

public _customizeGetPostsJoin(mixed $join, WP_Query $wp_query) : string
Parameters
$join : mixed
$wp_query : WP_Query
Return values
string

_customizeGetPostsWhere()

public _customizeGetPostsWhere(string $where, WP_Query $wp_query) : mixed
Parameters
$where : string
$wp_query : WP_Query
Return values
mixed

convertToIdTitleList()

public convertToIdTitleList(array<string|int, int>|array<string|int, WP_Post$posts) : array<string|int, mixed>
Parameters
$posts : array<string|int, int>|array<string|int, WP_Post>

Array of post ids or posts

Return values
array<string|int, mixed>

Array id => title

create()

Insert Post to DB

public create(WPPostData $postData) : int
Parameters
$postData : WPPostData
Tags
since
3.7.0

added new filter - "{postType}_persistence_new_post_data".

Return values
int

The post ID on success. The value 0 on failure.

createOrUpdate()

public createOrUpdate(WPPostData $postData) : int
Parameters
$postData : WPPostData
Return values
int

delete()

public delete(WPPostData $postData) : int
Parameters
$postData : WPPostData
Tags
since
3.7.0

added new action - "{postType}_persistence_before_delete_post".

Return values
int

Id of returned post. 0 on failure.

getCount()

public getCount([array<string|int, mixed> $atts = array() ]) : int
Parameters
$atts : array<string|int, mixed> = array()
Return values
int

getIdTitleList()

public getIdTitleList([mixed $atts = array() ][, mixed $extend = array() ]) : mixed
Parameters
$atts : mixed = array()
$extend : mixed = array()
Return values
mixed

getPost()

public getPost(mixed $id) : mixed
Parameters
$id : mixed
Return values
mixed

getPosts()

public getPosts([array<string|int, mixed> $atts = array() ]) : mixed
Parameters
$atts : array<string|int, mixed> = array()
Tags
since
3.7

added new filter - "{postType}_persistence_get_posts_atts".

since
3.8

parameter "suppress_filters" not forced to the value FALSE anymore.

Return values
mixed

update()

public update(WPPostData $postData) : int
Parameters
$postData : WPPostData
Return values
int

addGetPostsFilters()

protected addGetPostsFilters() : mixed
Return values
mixed

getDefaultQueryAtts()

protected getDefaultQueryAtts([array<string|int, mixed> $customAtts = array() ]) : array<string|int, mixed>
Parameters
$customAtts : array<string|int, mixed> = array()

Optional. Empty array by default.

Tags
since
3.7.0

added optional parameter $customAtts.

Return values
array<string|int, mixed>

modifyQueryAtts()

protected modifyQueryAtts(array<string|int, mixed> $atts) : array<string|int, mixed>
Parameters
$atts : array<string|int, mixed>
Return values
array<string|int, mixed>

removeGetPostsFilters()

protected removeGetPostsFilters() : mixed
Return values
mixed

updatePostRelatedData()

protected updatePostRelatedData(WPPostData $postData) : mixed
Parameters
$postData : WPPostData
Return values
mixed

Search results