PluginProbe ʕ •ᴥ•ʔ
GenerateBlocks / 2.2.0
GenerateBlocks v2.2.0
trunk 1.0 1.0.1 1.0.2 1.1.0 1.1.1 1.1.2 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.6.0 1.7.0 1.7.1 1.7.2 1.7.3 1.8.0 1.8.1 1.8.2 1.8.3 1.9.0 1.9.1 2.0.0 2.0.1 2.0.2 2.1.0 2.1.1 2.1.2 2.2.0 2.2.1 2.3.0
generateblocks / src / hooks / useTaxonomies.js
generateblocks / src / hooks Last commit date
index.js 1 year ago useAuthors.js 3 years ago useBlockStyles.js 1 year ago useDebounceState.js 4 years ago useDeviceAttributes.js 2 years ago useDeviceType.js 1 year ago useInnerBlocksCount.js 4 years ago useQueryReducer.js 1 year ago useRecordsReducer.js 3 years ago useSelectedBlockElements.js 2 years ago useStyleIndicator.js 2 years ago useTaxonomies.js 1 year ago useTaxonomyRecords.js 3 years ago
useTaxonomies.js
23 lines
1 import { useSelect } from '@wordpress/data';
2 import { store as coreStore } from '@wordpress/core-data';
3
4 export function useTaxonomies( postType ) {
5 return useSelect( ( select ) => {
6 const { getTaxonomies } = select( coreStore );
7
8 const args = { per_page: -1 };
9
10 /**
11 * Certain post types are excluded from this behavior since they are "pattern-like" and might display in a different
12 * content type than the one being edited.
13 */
14 const excludedPostTypes = [ 'gp_elements', 'wp_block' ];
15
16 if ( postType && ! excludedPostTypes.includes( postType ) ) {
17 args.types = postType;
18 }
19
20 return getTaxonomies( args ) || [];
21 }, [ postType ] );
22 }
23