Search code examples
wordpresscategories

WordPress: Remove "Parent" dropdown from category form


Hi I've downloaded a plugin "Simple Staff List" and it does what I need but I don't want editors to create a sub-category. How can I remove/hide the "Parent" selectbox on the form?parent selectobox on form


Solution

  • Add bellow code in your current theme function.php file.

    add_action( 'admin_head-edit-tags.php', 'wpse_58799_remove_parent_category' );
    
    function wpse_58799_remove_parent_category()
    {
        if ( 'category' != $_GET['taxonomy'] )
            return;
    
        $parent = 'parent()';
    
        if ( isset( $_GET['action'] ) )
            $parent = 'parent().parent()';
    
        ?>
            <script type="text/javascript">
                jQuery(document).ready(function($)
                {     
                    $('label[for=parent]').<?php echo $parent; ?>.remove();       
                });
            </script>
        <?php
    }