Click now for free estimate
blogdetailGo Back

How to remove child selection when adding or editing taxonomies for custom post type

May 20, 2014 | By August Infotech
How to remove child selection when adding or editing taxonomies for custom post type

add_action( 'admin_head-edit-tags.php', 'remove_child_taxonomy_selection_box' ); function remove_child_taxonomy_selection_box() { // don't run in the Tags screen if ( 'customposttype_name' != $_GET['taxonomy'] ) return; // Screenshot_1 = New Category // http://example.com/wp-admin/edit-tags.php?taxonomy=category $parent = 'parent()'; // Screenshot_2 = Edit Category // http://example.com/wp-admin/edit-tags.php?action=edit&taxonomy=category&tag_ID=17&post_type=post if ( isset( $_GET['action'] ) ) $parent = 'parent().parent()'; ?> jQuery(document).ready(function($) { checkval(); $("#parent").live('click',function(){ checkval(); }); }); function checkval() { jQuery("#parent option").each(function(index){ if(!jQuery(this).hasClass('level-0')) { jQuery(this).remove(); } }); } <?php }

Related Blogs

Get in touch

Our website address

Blog Page

CATEGORIES

CMS

TAGS

Wordpress
Contact Us
SVG Modal background

Don't just make a living
Make a difference, Take it higher

Close
Close

Get your
free quotation today