Skip to content
Branch: master
Find file History
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
test Remove findDOMNode usage from the NavigableToolbar component (#11401) Nov 6, 2018
README.md
check.js
flat-term-selector.js Fix minor typos in inline docs (#14690) Mar 28, 2019
hierarchical-term-selector.js Seimplify hierarchical term selector strings. (#13938) Mar 8, 2019
index.js
style.scss Hierarchical terms sorted by name and filterable (#10138) Sep 27, 2018

README.md

PostTaxonomies

PostTaxonomies is a component used to render the taxonomy picker UI. It uses the FlatTermSelector or HierarchicalTermSelector components based on the value of the hierarchical argument specified in register_taxonomy.

The output of the respective taxonomy components can be customized using the following filter:

  • editor.PostTaxonomyType

This hook can be used to render alternative UI based on the needs of that taxonomy.

Custom Taxonomy Selector

For example, to render alternative UI for the taxonomy product-type, we can render custom markup or use the original component as shown below.

var el = wp.element.createElement;

function customizeProductTypeSelector( OriginalComponent ) {
	return function( props ) {
		if ( props.slug === 'product-type' ) {
			return el(
				'div',
				{},
				'Product Type Selector'
			);
		} else {
			return el(
				OriginalComponent,
				props
			);
		}
	}
};

wp.hooks.addFilter(
	'editor.PostTaxonomyType',
	'my-custom-plugin',
	customizeProductTypeSelector
);
You can’t perform that action at this time.