f(x) Primary Term WP Registry grade A. No security issues foundWP RegistryNo security issues foundOpen the reportA
Set primary term for a taxonomy in a post.
Install
Upload it under Plugins → Add New Plugin → Upload Plugin, then activate.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/turtlepod/fx-primary-term/releases/download/1.0.2/fx-primary-term.1.0.2.zipSimple plugin to enable primary term. As default only supports Post Category.
Description
Simple plugin to enable primary term. As default only supports Post Category.
Developer can easily extend the plugin to support custom post types and custom taxonomy.
This plugin currently only supports hierarchical taxonomy.
This plugin is very similar with Yoast SEO plugin "Primary Term" functionality. You do not need this plugin if you already have Yoast SEO active.
Installation
- Navigate to "Plugins > Add New" Page from your Admin.
- To install directly from WordPress.org repository, search the plugin name in the search box and click "Install Now" button to install the plugin.
- To install from plugin .zip file, click "Upload Plugin" button in "Plugins > Add New" Screen. Browse the plugin .zip file, and click "Install Now" button.
- Activate the plugin.
Frequently Asked Questions
How to get primary term?
You can use fx_primary_term_get_primary_term() function. Here's an example usage.
$primary_category_id = fx_primary_term_get_primary_term( 'category', get_the_ID() );
if ( $primary_category_id ) {
// Do something.
}
How to add support to custom post type/taxonomy
Here's and example function for adding support for "genre" taxonomy in "book" cpt:
add_filter( 'fx_primary_term_taxonomies', function( $tax ) {
$tax['book'] = array( 'genre' );
return $tax;
} );
Screenshots
- No screenshots.
Changelog
1.0.2 - 18 Jan 2018
- Most Used Tabs Support.
1.0.1 - 15 Jan 2018
- Bug Fix: Now works with new post screen.
- Minor improvements.
- Deprecate & Change fx_primary_get_term_meta_key() to fx_primary_term_get_post_meta_key().
- Deprecate "fx_primary_term_meta_key" filter, now use "fx_primary_term_post_meta_key". No fallback.
1.0.0 - 12 Jan 2018
- Initial release.
Upgrade Notice
1.0.0
initial relase.
Other Notes
Notes for developer:
Github
Development of this plugin is hosted at GitHub. Pull request and bug reports are welcome.
Releases
3 releases. Each count is every asset in that release; expand a row for the breakdown.