PHP Class WPCC\Component\Factory\Term

Since: 1.0.0
Inheritance: extends WPCC\Component\Factory
Afficher le fichier Open project: 10up/wp-codeception

Protected Properties

Свойство Type Description
$_taxonomy string The taxonomy name.

Méthodes publiques

Méthode Description
__construct ( string $taxonomy = null ) Constructor.
addPostTerms ( integer $post_id, array $terms, string $taxonomy, boolean $append = true ) : array Adds terms to a post.
getObjectById ( integer $term_id ) : mixed Returns generated term by id.

Méthodes protégées

Méthode Description
_createObject ( array $args ) : integer | WP_Error Generates a new term.
_deleteObject ( integer $term_id ) : boolean Deletes previously generated term.
_updateObject ( mixed $term, array $fields ) : mixed Updates generated term.

Method Details

__construct() public méthode

Constructor.
Since: 1.0.0
public __construct ( string $taxonomy = null )
$taxonomy string The taxonomy name.

_createObject() protected méthode

Generates a new term.
Since: 1.0.0
protected _createObject ( array $args ) : integer | WP_Error
$args array The array of arguments to use during a new term creation.
Résultat integer | WP_Error The newly created term's ID on success, otherwise a WP_Error object.

_deleteObject() protected méthode

Deletes previously generated term.
Since: 1.0.0
protected _deleteObject ( integer $term_id ) : boolean
$term_id integer The term id to delete.
Résultat boolean TRUE on success, otherwise FALSE.

_updateObject() protected méthode

Updates generated term.
Since: 1.0.0
protected _updateObject ( mixed $term, array $fields ) : mixed
$term mixed The term id to update.
$fields array The array of fields to update.
Résultat mixed Updated term ID on success, otherwise a WP_Error object.

addPostTerms() public méthode

Adds terms to a post.
Since: 1.0.0
public addPostTerms ( integer $post_id, array $terms, string $taxonomy, boolean $append = true ) : array
$post_id integer The post id to add terms to.
$terms array The array of terms to add.
$taxonomy string The taxonomy name of terms.
$append boolean Determines whether to add or replace terms.
Résultat array The array of affected term IDs.

getObjectById() public méthode

Returns generated term by id.
Since: 1.0.0
public getObjectById ( integer $term_id ) : mixed
$term_id integer The term id.
Résultat mixed The generated term on success, otherwise NULL or a WP_Error object.

Property Details

$_taxonomy protected_oe property

The taxonomy name.
Since: 1.0.0
protected string $_taxonomy
Résultat string