WordPress.org

Make WordPress Core

Ticket #2938: uncheck-default-category.php

File uncheck-default-category.php, 634 bytes (added by mdawaffe, 15 years ago)

JS Plugin

Line 
1<?php
2/*
3Plugin Name: Uncheck Default Category
4Description: Unchecks the default category.  If no categories are checked, the post will still end up in the default category.
5Author: Michael D Adams
6Version: demo
7Author URI: http://blogwaffe.com/
8*/ 
9
10function uncheck_default_category() {
11        global $pagenow;
12
13        if ( 'post-new.php' === $pagenow ) {
14                echo "<script type='text/javascript'>//<![CDATA[\n";
15                echo "\taddLoadEvent( function() { document.getElementById('in-category-" . get_settings('default_category') . "').checked = false; } );\n";
16                echo "//]]></script>\n";
17        }
18}
19
20add_action('admin_head', 'uncheck_default_category');
21?>