I used the information posted on this blog post to display specific tags when editing a post. The editors on my site wanted the ability to display pre-specified tags instead of the most popular ones. We have a lot of tags and sometimes the ones they want to use are not being used because they are not seen and they don’t remember what to search for.
So in the wp-admin/includes/ajax-actions.php
file I changed the line 651 to
$tags = get_terms( $taxonomy, array(
'number' => 45,
'orderby' => 'name',
'order' => 'DESC',
'include' => array('21', '12')
) );
where the include
array is the selection of tags I want to display.
and line 665 to
$return = wp_generate_tag_cloud( $tags, array(
'largest' => 10,
'smallest' => 10,
'filter' => 0,
'format' => 'flat',
'separator' => " "
) );
This works fine for displaying a sequential list (I didn’t want a tag cloud) of specific tags but these changes are to the wordpress core and on the next update I’ll have to go in and re-do these. Is there any way to accomplish this with hooks so that I don’t mess with the core?
Thanks
We can override the Ajax call to
wp_ajax_get_tagcloud()
and do a clean hack.Restore your core files to its original state, copy the modified function inside the above container and create a plugin for it. And ready to go.