[wp-hackers] preventing new tags from being entered.

Haluk Karamete halukkaramete at gmail.com
Wed Sep 5 19:11:53 UTC 2012


> That's a pretty terrible user experience, especially given the default tag
> metabox. "Here, I'll let you enter tags arbitrarily, but some of them might
> not get used, and you won't know which ones!" In reality, you will want to
> check capabilities on save in case data is manipulated, so you will want to
> ignore new tags on update anyway. But just because it works behind the
> scenes doesn't mean that you shouldn't also account for the actual user.
> You still have to account for the actual tag/taxonomy admin screen as well.

I understand your point Helen. With all due respect though, I still
believe that ignoring the new tags at the server side is a better and
more native approach when you work with a trained group of people.
When you work with a closed circle of people which you can teach what
to do and what not to do, the problem you are rightly referring to
becomes a non-issue. I see it as  saying "enter a valid name" in a
form field and then firing back from the server side to tell the user
"we did not take your name because it contained numbers in it".

I will use your suggestion if I fail to achieve my goal by ignoring
the new tags at save/update time. But what is the hook that i need to
tap into to pull this off?

Again, my goal is to allow the front end of the dashboard work exactly
the same way as it behaves but thru this plugin/action hook, simply
ignore the new tags and return back with a script alert that this
taxonomy is locked for new tags and therefore, new tags have been
ignored.

On Wed, Sep 5, 2012 at 6:33 AM, Helen Hou-Sandi <helen.y.hou at gmail.com> wrote:
> On Wed, Sep 5, 2012 at 8:30 AM, Haluk Karamete <halukkaramete at gmail.com>wrote:
>
>> Hi Helen
>> Could you tell me the hooks/filters involved to make a change in the tag
>> meta box?
>>
>
> This is a bit of code I have lying around for replacing taxonomy metaboxes
> with a select-only interface using Chosen (
> http://harvesthq.github.com/chosen/) as a multiselect helper:
> https://gist.github.com/1573966
>
> The relevant hook is basically just add_meta_boxes, or
> add_meta_boxes_{$post_type}, so you can remove the metabox and then add
> your own. Because you have many tags, I would probably suggest creating a
> replacement that does autocomplete rather than loading all of the terms on
> page load. If you name the field correctly ($tax_input[$tax_name]), saving
> will take care of itself.
>
>
>> And also wouldn't it be easier to just ignore the new tags at the time of
>> update?
>>
>
> That's a pretty terrible user experience, especially given the default tag
> metabox. "Here, I'll let you enter tags arbitrarily, but some of them might
> not get used, and you won't know which ones!" In reality, you will want to
> check capabilities on save in case data is manipulated, so you will want to
> ignore new tags on update anyway. But just because it works behind the
> scenes doesn't mean that you shouldn't also account for the actual user.
> You still have to account for the actual tag/taxonomy admin screen as well.
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers


More information about the wp-hackers mailing list