Tried adding a child category using the post form but it failed adding the child category. I noticed this is because the child category is already used as a parent category. This should not be the case because the parent category of the same name is different from the child category of the same name.
For example:
I have `PHP` as a parent category. I still need to create `PHP` category but under `Client Specific` category. The form doesn't allow me.
Was able to add if I do it on admin add new category page but going into the admin defeats the purpose of having the form.
Tried this if I use an author account, admin account, and a modified subscriber account with `manage_categories` capabilities
I can see there is no limitation in the back end if you try to add a child category that already exists (you can even add the same category to an existing category as a child, e.g. PHP << PHP).
But in Forms we explicitly prevent this.
I found the code that is responsible, and edited it to simply comment out the key lines.
I then tested my form, and I could add the terms that had hitherto been blocked, and I checked the published post in the back end and saw that it did indeed have that structure.
So I'm escalating this to ask the developers to review and see if we can remove this limitation.
It's been like this for years, and as far as I can see we haven't had any other reports of the same, so I expect it won't be a development priority, so let me share the changes I made with you, and you can make the same changes on your own site and test to ensure there are no side effects.
I edited the file wp-content/plugins/cred-frontend-editor/public/js/frontend.js, from line 129 I commented out the lines like so:
// Check if we already have a trm with that name.
var exists = false;
$( 'input[name="' + taxonomy + '\[\]"]', $form ).each( function() {
// var label = $( this ).data( 'value' );
// if ( new_taxonomy === label ) {
// exists = true;
// self._flash_it( $( this ).parent( 'label' ) );
// return false;
// }
});
$('select[name="' + taxonomy + '\[\]"]', $form).find('option').each( function() {
// if ( new_taxonomy === $( this ).text() ) {
// exists = true;
// self._flash_it( $( this ) );
// return false;
// }
});
You can test the same on your own site and use it until such time as the developers review and remove this restriction.