Skip to content

Taxonomy

rogertm edited this page Oct 11, 2023 · 7 revisions

abstract class Taxonomy

Para crear taxonomías debemos crear una nueva clase extendida de WASP\Taxonomy\Taxonomy.

<?php
use WASP\Taxonomy\Taxonomy;

class My_Plugin_Custom_Taxonomy extends Taxonomy
{

	function __construct()
	{
		parent::__construct();
		$this->taxonomy	= 'my-custom-taxonomy';
		$this->object_type	= 'post';
		$this->labels 		= array( ... );
		$this->args 		= array( ... );
	}
}
new My_Plugin_Custom_Taxonomy;

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.

Referencias

Clone this wiki locally