Support » Fixing WordPress » Dashboard > Category filter does not work after new category

  • Hello everyone,
    I created this filter to exclude the possibility for admins to create a parent category:

    function no_parent_category() {
    	 global $pagenow, $post;
        if(($pagenow == 'post.php' || $pagenow == 'post-new.php') && $post->post_type=='blog')
        {
    ?>
     <script type="text/javascript">
    		   jQuery(document).ready(function($)
                {
                 $('#newcategory_parent option[value=-1]').remove();
                });
            </script>
    
    <?php
    }
    }
    add_action('admin_head', 'no_parent_category');

    This works great, but if an admin create a new subcategory (i.e. on the post-new.php page) in the category “floatbox”, the option to create a parent category shows up again.

    Does anybody know why this is the case and how to prevent it from showing up?
    Thanks

  • The topic ‘Dashboard > Category filter does not work after new category’ is closed to new replies.