WP Manifestindependent plugin directory
manifest / content / viget-primary-term

Viget Primary Term

WordPress plugin that allows you to specify a Primary Term for a Taxonomy.

★ 0stars
3release downloads
88composer installs
v1.0.0latest · 8d ago

Install

Download viget-primary-term.zip From the v1.0.0 release on GitHub, Oct 5, 2026

Upload it under Plugins → Add New Plugin → Upload Plugin, then activate.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/vigetlabs/viget-primary-term/releases/download/v1.0.0/viget-primary-term.zip

On Packagist as viget/viget-primary-term:

composer require viget/viget-primary-term
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

WordPress 6.5+ PHP 8.2+ Latest release CI status License

Viget Primary Term

Lets editors pick a primary term for a post from the block editor's taxonomy panels, e.g. a primary category for a post with several.

Features

  • Turn taxonomies on from Settings → Primary Terms, or register them in code with the vgpt_registered_taxonomies filter. Registered taxonomies show on the settings page as locked rows.
  • A Primary {Term} select appears under the taxonomy's panel once 2+ terms are checked. It lists only the checked terms, including ones just added from the panel.
  • The first option shows the fallback, e.g. "Default: Chains › Roller". With no primary term, get_primary_term() uses the deepest term (hierarchical) or the first by name (flat).
  • Unchecking the primary term clears it.
  • Checks for updates from GitHub releases in the WordPress dashboard.

Block editor only. The classic editor isn't supported.

Installation

Manual

  1. Download the latest release zip.
  2. Upload it via Plugins → Add New → Upload Plugin, or extract it to wp-content/plugins/viget-primary-term/.
  3. Activate the plugin.

Composer

composer require viget/viget-primary-term

Usage

Turn on a taxonomy from Settings → Primary Terms, or in code:

add_filter(
    'vgpt_registered_taxonomies',
    function ( array $taxonomies ): array {
        $taxonomies[] = 'product_category';
        return $taxonomies;
    }
);

Read a post's primary term:

$term = vgpt()->get_primary_term( $post_id, 'product_category' );

The term ID is stored in post meta as _vgpt_primary_{taxonomy}, registered for the REST API on every post type the taxonomy is attached to. Those post types get custom-fields support, which the REST API needs to include meta.

Auto-Updates

This plugin checks GitHub releases every 12 hours and surfaces updates in Plugins. See includes/class-github-plugin-updater.php. That's incompatible with the wordpress.org plugin directory, which this plugin isn't listed in.

Developer API

Public methods and filters are documented in docs/api.md.

Development

npm install        # JS build tooling
npm run start      # watch mode
npm run build      # production build (build/ is committed)
npm run lint:js    # eslint
npm run lint:css   # stylelint
composer install   # PHPUnit
npm run env:start  # wp-env (Docker), on ports 8898/8899
npm test           # PHPUnit against real WordPress

Releases

1 release. Each count is every asset in that release; expand a row for the breakdown.

Tag
Published
Assets
Downloads
v1.0.0 latest
Oct 5, 2026 8d ago
viget-primary-term.zip
3