Download the PHP package underpin/taxonomy-loader without Composer
On this page you can find all versions of the php package underpin/taxonomy-loader. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download underpin/taxonomy-loader
More information about underpin/taxonomy-loader
Files in underpin/taxonomy-loader
Package taxonomy-loader
Short Description Taxonomy loader for Underpin
License GPL-2.0-or-later
Informations about the package taxonomy-loader
Underpin Taxonomy Loader
Loader That assists with registering taxonomy taxonomies to a WordPress website.
Installation
Using Composer
composer require underpin/taxonomy-loader
Manually
This plugin uses a built-in autoloader, so as long as it is required before Underpin, it should work as-expected.
require_once(__DIR__ . '/underpin-taxonomies/taxonomies.php');
Setup
- Install Underpin. See Underpin Docs
- Register new taxonomies menus as-needed.
Example
A very basic example could look something like this.
Alternatively, you can extend Taxonomy and reference the extended class directly, like so:
Querying
A Taxonomy instance includes a method, called query, which serves as a wrapper for new WP_Term_Query.
This encapsulates queries for this taxonomy in a method, and gives you a place to override exactly how this taxonomy is queried, should you decide to extend the class.
Editing Terms
Like querying, Taxonomy instances includes a method called save which serves as a wrapper for wp_insert_term
and wp_update_term. It also includes notice-logging so you can track what happens on a request.
This encapsulates save actions for this taxonomy in a set of methods, and gives you a place to override exactly how this taxonomy is saved, should you decide to extend the class.
Deleting Terms
This works in the same way as save and query. It includes logging, and provides a way to encapsulate the action.