0

Writers on my websites have no discipline. I told them to only use tags found via autocompletion, but they keep creating tags with mistake, typos and specially duplicate.

The best could be to remove the tags if they are not found, in JS, directly after the ajax request that do the autocompletion.

But I find no place were I could hook to forbid user to create tags, either in JS nor wp actions.

Any idea how to perform this?

1 Answer 1

0

This will disable the Tags suggesstion:

function wpse207107_dequeue_suggest() {
    global $post_type;

    if ( is_admin() && $post_type == 'post' ) {
        wp_dequeue_script( 'suggest' );
        wp_deregister_script( 'suggest' );
    }
}
add_action( 'admin_enqueue_scripts', 'wpse207107_dequeue_suggest', 5 );

However, that might disable some other suggest functionalities if other plugins uses the script. Alternatively, you can entirely remove the Tags metag box for non-admin if you want them not to tag the post while keeping it for admins.

function wpse207107_remove_tags_meta_box() {
    if ( !current_user_can( 'administrator' ) ) {
        remove_meta_box( 'tagsdiv-post_tag', 'post', 'side' );
    }
}
add_action( 'do_meta_boxes', 'wpse207107_remove_tags_meta_box' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.