PHP code example of tfrommen / linked-taxonomies

1. Go to this page and download the library: Download tfrommen/linked-taxonomies library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

tfrommen / linked-taxonomies example snippets


/**
 * Filters the capability ty Capability ability', function() {
	
	return 'manage_categories';
} );

/**
 * Filters the taxonomies that are available for linking.
 *
 * @param object[] $taxonomies Taxonomy objects.
 */
add_filter( 'linkable_taxonomies', function( $taxonomies ) {

	// Remove taxonomies that are not built in but public
	foreach ( $taxonomies as $key => $taxonomy ) {
		if ( ! $taxonomy->_builtin && $taxonomy->public ) {
			unset( $taxonomies[ $key ] );
		}
	}
	
	return $taxonomies;
} );

/**
 * Filters the args for getting all taxonomies.
 *
 * @param array $args Taxonomies args.
 */
add_filter( 'linked_taxonomies_get_taxonomies_args', function() {

	// Only list taxonomies that are hierarchical and show their individual tag cloud
	return array(
		'hierarchical'  => 1,
		'show_tagcloud' => 1,
	);
} );

/**
 * Filters the capability ty Capability ability', function() {
	
	return 'manage_options';
} );