-
Notifications
You must be signed in to change notification settings - Fork 0
Taxonomy
rogertm edited this page Jun 20, 2025
·
7 revisions
Para crear taxonomías debemos crear una nueva clase extendida de WASP\Taxonomy\Taxonomy.
php cli/wasp create:taxonomy "Genre" wasp-book<?php
namespace WASP\Taxonomy;
use WASP\Taxonomy\Taxonomy;
class Taxonomy_Genre extends Taxonomy
{
public function __construct()
{
parent::__construct();
// Taxonomy slug
$this->taxonomy = 'wasp-genre';
// Object type
$this->object_type = 'wasp-book';
// Taxonomy labels
$this->labels = array(
'name' => _x( 'Genre', 'Taxonomy general name', 'wasp' )
);
// Taxonomy arguments
$this->args = array(
'public' => true
);
}
}La propiedad labels hace referencia a $args['labels'] en la función register_taxonomy(), args al resto de los argumentos pasados a esta función.
- Function
register_taxonomy().