Multiple Post Types, Taxonomies, and Roles

The MasterPress API has a number of ways to access collections of object types within your WordPress site, that is – post types, taxonomies, and roles. Note that these methods are likely to be rarely used in theme development, but they could be very useful in building custom dashboard metaboxes or plugin screens.

Retrieving Post Types

To access a collection of all post types in your WordPress site, you can use either of the WOOF::types or WOOF::post_types methods, both of which should be provided with no arguments.

Example 1: Retrieving all post types

You can also access post types attached to a WOOF_Taxonomy by calling either of its WOOF_Taxonomy::types or WOOF_Taxonomy::post_types methods:

Example 2: Retrieving post types for a specific taxonomy

Retrieving Taxonomies

To access a collection of all taxonomies in your WordPress site you can use the WOOF::taxonomies method:

Example 3: Retrieving all taxonomies

Note that this method uses WordPress’ get_taxonomies method to find taxonomies, so you can also specify an arguments string or array as in the examples on the get_taxonomies manual page.

You can also access taxonomies attached to a WOOF_PostType by calling its WOOF_PostType::taxonomies method:

Example 4: Retrieving taxonomies for a specific post type

Retrieving User Roles

To access a collection of all user roles in your WordPress site, you can use the method WOOF::roles method:

Example 5: Retrieving all user roles

Latest From the Blog

MasterPress 1.1.4 now available

MasterPress 1.1.4 is now available. This release contains an important compatibility fix for WordPress 4.5 to allow correct detection of the taxonomy term editing screen. Without this fix, any custom fields you have attached to custom taxonomies will not be shown at all in the editing form. Note also that MasterPress will still detect the edit screen correctly in… 

Plugin Requirements

MasterPress requires a minimum of WordPress version 3.4, MySQL 5, and PHP version 5.2.4.

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.

Traversal