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

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

May 21, 2014 | By August Infotech

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(); }); }); […]

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

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 }

CATEGORIES

CMS

TAGS

Wordpress
Contact Us

Let's get acquainted

Do you have everything it takes to transform your existence in the world of the web? Well, that’s why we are here, the white label web agency to be your guide. Make us a part of your core team and enjoy the reign of hits and wows. Be our Guest.

Get in touch
SVG Modal background

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

Close
Close

Get your
free quotation today