Restrict post tags to prevent free tagging in write screen (2 posts)

  1. houseofstrauss
    Posted 6 years ago #

    n the post screen, I want to remove the option of multi-authors being able to 'free tag' their posts. In other words, only allow tags that have been preset in the admin tags section.(these tags are of course visible in the tag cloud in posts screen) The concept is to prevent authors introducing random tags in their posts, leading to duplication and confusion.
    Can't see any plugins to do this, but may be other ways to do it?

  2. houseofstrauss
    Posted 6 years ago #

    I found this on stackoverflow:

    Add the following code to the function.php file in the WordPress theme you are using. Take note of the closing and opening PHP tags. This will disable and hide the field and Add New Tag button making the only tagging option the pre-defined tags in the admin section.

    Big thanks to hsatterwhite for his reply, and it works well.

    function disable_tags()
        <script type='text/javascript'>
            jQuery(document).ready(function() {
                jQuery('#new-tag-post_tag').attr("disabled", "disabled").css("display", "none");
                jQuery('.tagadd').attr("disabled", "disabled").css("display", "none");
                jQuery('#post_tag').css("display", "none");
    add_action('admin_head', 'disable_tags');

Topic Closed

This topic has been closed to new replies.

About this Topic