WOOF_Taxonomy

Represents a single Taxonomy (custom or built-in) within WordPress, containing many powerful methods for working with the terms within each taxonomy. 

Example: Ways to obtain a WOOF_Taxonomy

List of Methods

Property Methods

Manipulation

  • create( Arguments $args = array(), Boolean $update = false, Boolean $strip = true )WOOF_Term

    Creates a new WOOF_Term object in this taxonomy, which can either have properties set by passing properties in the $args parameter, or setting them manually later in code (via the use of the magic method ---set).

  • find_or_create( String $slug )WOOF_Term

    Retrieves a term object in this taxonomy by first trying to find a term with the specified $slug, or creating a new term with the specified slug if not found.This method could be very useful in some kind of import process, where you might want to create or update terms from another data source (such as a JSON API) without needing to worry about checking for existence first (see example).

  • insert( Arguments $args, Boolean $strip = true )WOOF_Term

    A more readable synonym for the WOOF_Taxonomy::insert to create a term in this taxonomy and immediately update the database.

Taxonomy Terms

  • create( Arguments $args = array(), Boolean $update = false, Boolean $strip = true )WOOF_Term

    Creates a new WOOF_Term object in this taxonomy, which can either have properties set by passing properties in the $args parameter, or setting them manually later in code (via the use of the magic method ---set).

  • find_or_create( String $slug )WOOF_Term

    Retrieves a term object in this taxonomy by first trying to find a term with the specified $slug, or creating a new term with the specified slug if not found.This method could be very useful in some kind of import process, where you might want to create or update terms from another data source (such as a JSON API) without needing to worry about checking for existence first (see example).

  • flatten_terms( Arguments $args = array() )WOOF_Collection of WOOF_Term

    Flattens a hierarchical term structure into a flat collection of terms.This method uses get_terms to retrieve the terms, so you can further clarify the query used with the args parameter.

  • non_empty_terms( Arguments $args = array() )WOOF_Collection of

    A preset on the method WOOF::terms to retrieve a collection of terms for this taxonomy which are non-empty, that is, currently in use by one or more posts.

  • non_empty_top_level_terms( Arguments $args = array() )WOOF_Collection of

    A preset on the method WOOF::terms to retrieve a collection of terms for this taxonomy which are both non-empty (in use by one or more posts) and at the top level of the taxonomy hierarchy.This method uses get_terms to retrieve the terms, so you can further clarify this query with the args parameter.

  • term( Mixed $id ) OR WOOF_Silent

    Retrieve a term object in this taxonomy for the given $id.Note that this method forwards on to the WOOF::term method to retrieve the term, so the $id parameter can be a slug, ID, or even a WOOF_Term object itself (which will simply return this object).

  • terms( Arguments $args = array() )WOOF_Collection of

    A preset on the method WOOF::terms to retrieve a collection of terms for this taxonomy.This method uses get_terms to retrieve the terms, so you can further clarify this query with the args parameter.

  • top_level_terms( Arguments $args = array() )WOOF_Collection of

    A preset on the method WOOF::terms to retrieve a collection of terms for this taxonomy which are at the top level of the taxonomy hierarchy.This method uses get_terms to retrieve the terms, so you can further clarify this query with the args parameter.

  • top_terms( Arguments $args = array() )WOOF_Collection of

    An alias for the method WOOF_Taxonomy::top_level_terms and a preset on the method WOOF::terms to retrieve a collection of terms for this taxonomy which are at the top level of the taxonomy hierarchy.This method uses get_terms to retrieve the terms, so you can further clarify this query with the args parameter.

Capabilities

  • cap( String $key, String $fallback )String

    Returns the custom capability key in use for a given standard capability key.

Post Types

Internal Use

  • iterator_items()Array

    Allows the post type to be directly iterated over, by returning all posts under this post type as items for the collection.

  • iterator_items()Array

    Allows the taxonomy to be directly iterated over, by returning all terms under this taxonomy as items for the collection.

Base Class Methods

View method list from the base class WOOF_Collection.

Latest From the Blog

MasterPress 1.4.1 is now available

27th May 2024

This update addresses backwards compatibility issues that were introduced in the previous update. There were some edge cases where PHP 7 had issues and it didn’t work at all on PHP 5.6.We have now changed it so that the PHP 8 compatibility changes will now only affect PHP 8 and will be more thorough with… 

Plugin Requirements

MasterPress requires a minimum of WordPress version 4.9, MySQL 5.6, and PHP version 5.6.20.

We also recommend that PHP is configured to use a memory limit of 64MB per request (128MB may be required for sites with higher complexity).

This plug-in is not compatible with the WordPress.com hosted service.

Three AM