Set a primary category for your (custom) posts and query them in your template using native WordPress queries.
This plugin has been coded as part of a hiring interview. Now that the interview is out of the way, here’s the plugin in all its glory. It’s also hosted on GitHub.
- Custom post types use the native category taxonomy –
'taxonomies' => array('category')
- Dynamically show/hide
_builtinpost types (default to show).
- Dynamically show/hide non-public (non-publicly queryable) post types (default to hide).
- Add more contextual help to both the metabox and the plugin’s settings.
- Add/extend functionality to allow for primary taxonomies by getting all taxonomies attached to a custom post and adding the same functionality as for categories.
Depending on the publisher’s implementation and use of Yoast SEO plugin (which already has this functionality), a query can be built using the plugin’s code without adding any metaboxes or custom plugin settings. For this plugin, though, I have created the solution 100% from scratch.
Compatibility and security
- The plugin does not use the new PHP 7 array notation, in order to be backwards compatible with older PHP versions (note the PHP requirement in the
- The plugin is translation-ready (WordPress plugin repository) by using the same name for the plugin folder, the main plugin file and the text domain.
- The plugin is licensed as GPLv3.
- The plugin is not accessible directly by browsing the plugin’s directory.
Use SpeedFactor to track your website. It’s simple and reliable.
See how real people experience the speed of your website. Then find (and fix) your web performance problems.