Randomizing wp_tag_cloud() in child theme

Question

I’m trying to write a wordpress function code in my child theme that randomizes the words in the word cloud where previously it was alphabetized.

The code Im using is below, which doesn’t work.

//
add_filter('wp_tag_cloud_args', 'my_wp_tag_cloud_args_filter');
function my_wp_nav_menu_args_filter($args) {
    $args['order'] = 'RAND';
    // do something
    return $args;
}
//

I’m able to update the wp_tag_cloud()’s default (‘Order’ = ‘RAND’) args in wp-includes/category-template.php but I know that any changes will get replaced. The change work when in that file.

How can I move those set of changes to my wordpress child theme?

0
, , , , T. Thomas 3 years 2020-07-08T02:11:25-05:00 0 Answers 65 views 0

Leave an answer

Browse
Browse