Great tutorial, I am working on a custom post type and I’ve created a custom metabox drop down for AM or PM but it won’t save my value. Can someone help me? I’m in a jam with my deadline looming. I can send my code.
[...] Would you like to add new custom fields to your WordPress posts, pages, and categories? Now you can easily do this with the WordPress custom taxonomy system . For example, if you have a blog on movie reviews, you may want to add the fields Actors and Genre to each of your posts. WordPress Custom Taxonomy Input Panels [...]
Hi,
I got it all working in my backend (created custom taxonomy drop down, saves, updates etc), but is there any possibility to use the custom taxonomies on my front-end form?
I use a custom made front-end form. How can i display the custom made taxonomy dropdown there and be save the data once the user sends the form? Is there any code or source i can use for this?
Thanks for the tutorial. One question, can I allow multiple selection using:
<select multiple ='multiple'…
I get the expected result visually, but as expected only the last value is saved. Is there a way to extend the save_taxonomy_data function to hold multiple ie array of values.
Thanks again,
John
Instead of doing !strcmp($theme->slug, $names[0]->slug), you would need to check for the entire $names array with something like an in_array.
8:32 pm on
May 1st, 2012
kathy
so i’ve successfully implemented both this and you ‘expand the wordpress quick edit’ tutorial. compliments on such intricate and valuable tutorials. i have learned a ton from your site that i can’t find anywhere else. i’m finding that if i do both, however, then i end up w/ two actions attached the the save_post hook and this is causing problems with undefined indexes: ie. nonces from one that aren’t in the $_POST of the other. can you think of a check to only run the added function if it is run on the quick edit screen versus if it is run on the normal edit post page?
turns out that you can test for whether the save is coming from the quick edit screen by checking if $_POST['action'] == ‘inline-save’. (i believe it equals ‘edit’ from the edit screen.
however, in the end, i decided it was redundant to have 2 functions attached to ‘save_post’ to do the same thing: since the taxonomy metabox and the quick edit box are handling the same data, so i combined them into 1 function. works great. i was concerned about needing to use different nonces, but WP uses the same nonce name (‘_wpnonce’) in both places, so i figured i could too. thanks again!
[...] WordPress Custom Taxonomy Input Panels remove_meta_box ( 'tagsdiv-theme' , 'post' , 'core' ) ; Note – For non-hierarchical taxonomies (like tags) you want to use tagsdiv-{$taxonomy_name}, e.g. tagsdiv-theme . For hierarchical taxonomies (like categories) you want to use {$taxonomy_name}div, e.g. themediv . [...]
Great tutorial. If anyone is already using WPAlchemy Metaboxes, I did a small tutorial on how to use your method together with it. My tutorial can be found Custom taxonomy metaboxes with WPAlchemy MetaBox. Thanks!
[...] I came across this awesome resource on “WordPress Custom Taxonomy Input Panels” by shibashake that sparked the idea. I will be doing something almost similar, except I’ll be [...]
Hi Shibashake, thanks for the great tutorial. I’ve gotten everything to work, but am stuck on removing a meta box (input field) from the custom taxonomy “Add New Category” page and “Edit Category” page.
By default, the input fields for creating or editing a category are “Name”, “Slug”, “Parent”, and “Description”. I’m trying to remove the “Description” field but can’t figure out how.
I was even just thinking about setting that field to display: none but it doesn’t have a unique class or id. Any ideas? Thanks!
The only problem is, that now I’m wanting to add an input field on the custom taxonomy “Add New Category” page and “Edit Category” page but have no idea how to do this. any clues?
let just say, in my database, term_id for Halloween is 13. i made a post and i choosed theme ‘Halloween’. after that, i clicked Publish button. then i checked wp_posts, the id of my post is 15. then i checked wp_term_relationships, only object_id with id 15 and term_taxonomy_id is 1. not object_id with id 15 and term_taxonomy_id is 13.
- any idea how to add a username in a link?
for exampe. site url: http://mysite.com/
now adding a username makes it http://mysite.com/username
note. ...
Great tutorial, I am working on a custom post type and I’ve created a custom metabox drop down for AM or PM but it won’t save my value. Can someone help me? I’m in a jam with my deadline looming. I can send my code.
Best,
James
If something is not saving, I usually just try to echo something out in the save_taxonomy_data function and then exit. For example -
This lets me know if I am hitting the save function, and what input values it is getting.
[...] Would you like to add new custom fields to your WordPress posts, pages, and categories? Now you can easily do this with the WordPress custom taxonomy system . For example, if you have a blog on movie reviews, you may want to add the fields Actors and Genre to each of your posts. WordPress Custom Taxonomy Input Panels [...]
Hi,
I got it all working in my backend (created custom taxonomy drop down, saves, updates etc), but is there any possibility to use the custom taxonomies on my front-end form?
I use a custom made front-end form. How can i display the custom made taxonomy dropdown there and be save the data once the user sends the form? Is there any code or source i can use for this?
thnx!
Thanks for the tutorial. One question, can I allow multiple selection using:
<select multiple ='multiple'…
I get the expected result visually, but as expected only the last value is saved. Is there a way to extend the save_taxonomy_data function to hold multiple ie array of values.
Thanks again,
John
Try -
Any ideas for using checkboxes?
Have come up with:
echo "name . "' value='" . $theme->slug . "' checked='yes'>" . $theme->name . "\n";
else
echo "name . "' value='" . $theme->slug . "' >" . $theme->name . "\n";
However, will only save the first option if more then one is checked, or the checked option if only one.
For multiple selections the name should have square brackets.
Thanks for the reply!
Originally I posted with [code] and this is what I had..
So, as stated, still only saves first option or onle of the selected..
Do I need to define an array before wp_set_object_terms() and if so, where?
Instead of doing !strcmp($theme->slug, $names[0]->slug), you would need to check for the entire $names array with something like an in_array.
so i’ve successfully implemented both this and you ‘expand the wordpress quick edit’ tutorial. compliments on such intricate and valuable tutorials. i have learned a ton from your site that i can’t find anywhere else. i’m finding that if i do both, however, then i end up w/ two actions attached the the save_post hook and this is causing problems with undefined indexes: ie. nonces from one that aren’t in the $_POST of the other. can you think of a check to only run the added function if it is run on the quick edit screen versus if it is run on the normal edit post page?
turns out that you can test for whether the save is coming from the quick edit screen by checking if $_POST['action'] == ‘inline-save’. (i believe it equals ‘edit’ from the edit screen.
however, in the end, i decided it was redundant to have 2 functions attached to ‘save_post’ to do the same thing: since the taxonomy metabox and the quick edit box are handling the same data, so i combined them into 1 function. works great. i was concerned about needing to use different nonces, but WP uses the same nonce name (‘_wpnonce’) in both places, so i figured i could too. thanks again!
[...] WordPress Custom Taxonomy Input Panels remove_meta_box ( 'tagsdiv-theme' , 'post' , 'core' ) ; Note – For non-hierarchical taxonomies (like tags) you want to use tagsdiv-{$taxonomy_name}, e.g. tagsdiv-theme . For hierarchical taxonomies (like categories) you want to use {$taxonomy_name}div, e.g. themediv . [...]
Great tutorial. If anyone is already using WPAlchemy Metaboxes, I did a small tutorial on how to use your method together with it. My tutorial can be found Custom taxonomy metaboxes with WPAlchemy MetaBox. Thanks!
[...] I came across this awesome resource on “WordPress Custom Taxonomy Input Panels” by shibashake that sparked the idea. I will be doing something almost similar, except I’ll be [...]
Hi Shibashake, thanks for the great tutorial. I’ve gotten everything to work, but am stuck on removing a meta box (input field) from the custom taxonomy “Add New Category” page and “Edit Category” page.
By default, the input fields for creating or editing a category are “Name”, “Slug”, “Parent”, and “Description”. I’m trying to remove the “Description” field but can’t figure out how.
I was even just thinking about setting that field to display: none but it doesn’t have a unique class or id. Any ideas? Thanks!
so after a lot of trial and error, i managed to remove the description field via a jquery hack.
// this removes the admin description input field when var userSettings pagenow is edit-erw_menu_cats
function erw_hide_descrip()
{
echo "
if ( pagenow == 'edit-erw_menu_cats') { // begin conditional
$(function(){
$('div.wrap form.validate table.form-table tr.form-field:last').hide(); // removed from edit category page
$('div.col-wrap div.form-wrap div.form-field:last').hide(); // removed from add new category page
});
}; // end conditional
";
}
add_action( 'admin_head', 'erw_hide_descrip' );
The only problem is, that now I’m wanting to add an input field on the custom taxonomy “Add New Category” page and “Edit Category” page but have no idea how to do this. any clues?
finally found it….
http://wordpress.stackexchange.com/questions/689/adding-fields-to-the-category-tag-and-custom-taxonomy-edit-screen-in-the-wordpr
hope this helps someone
can i use this at WP 3.2.1?
It should work since I use it in several of my plugins. Let me know if you run into any problems.
thanks for your quick reply , shibashake.
let just say, in my database, term_id for Halloween is 13. i made a post and i choosed theme ‘Halloween’. after that, i clicked Publish button. then i checked wp_posts, the id of my post is 15. then i checked wp_term_relationships, only object_id with id 15 and term_taxonomy_id is 1. not object_id with id 15 and term_taxonomy_id is 13.
finally i can do it, shibashake.
maybe i lost one step. thanks for your great tutorials.
i have another question, shibasake.
how to make dropdown to be checkbox?
and how to save the data?
help me please…