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.3.10 is now available

9th November 2023

MasterPress 1.3.10 is a feature and bugfix release. Workaround for fatal error introduced by changes to WordPress’ wpdb class in WordPress 6.4. Added actions to MPC files upload_field & WF image save_image functions.

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