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

Ability to deactivate licence domains within MasterPress account management

25th October 2024

We have just rolled out an account management feature which allows licence holders to have better control over the domains that use their licence key. From the MasterPress Account Management page, the list of Active Sites that use your licence now includes a function that allows you to remove a domain from your licence. Simply… 

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