I have registered new post type with custom taxonomy on my WP, so now I have two post types (defaultpt & custompt) and two tag taxonomies (defaulttax & customtax).
I want to insert two instances of the native Tag Cloud Widget on my site:
Tag cloud placed on single defaultpt post widget area displays tags from defaulttax.
Tag cloud placed in the footer widget area (same for whole site) displays tags from customtax.
When I place Tag cloud widgets on an appropriate widget areas and select desired taxonomy, it displays tag correctly as desired. However, tag cloud is created with default parameters (sort, order, etc.) and I want to change it. These two tag cloud instances should display tags in the same way.
So, I've added a filter a widget_tag_cloud_args filter in my functions.php:
function all_tag_cloud_widget_params() {
$args = array(
'smallest' => 10,
'largest' => 10,
'unit' => 'pt',
'number' => 40,
'format' => 'flat',
'separator' => "\n",
'orderby' => 'count',
'order' => 'DESC'
);
return $args;
}
add_filter( 'widget_tag_cloud_args', 'all_tag_cloud_widget_params' );
Now, on my both instances of tag cloud widget displays tags in correct way but only from defaulttax. Admin "Taxonomy" widget setting is ignored.
Adding parameter:
'taxonomy' => array( 'defaulttax', 'customtax' )
forces both widgets to display tags from both taxonomies.
Adding:
'taxonomy' => ''
crashes the widgets.
This filter should use a taxonomy set in the widget settings but after lot of web searching I could not find any solution.
So, my question is: how to pass a "in-widget selected taxonomy" variable value to this filter?