Ticket #2938: uncheck-default-category.php
| File uncheck-default-category.php, 0.6 kB (added by mdawaffe, 2 years ago) |
|---|
| Line | |
|---|---|
| 1 | <?php |
| 2 | /* |
| 3 | Plugin Name: Uncheck Default Category |
| 4 | Description: Unchecks the default category. If no categories are checked, the post will still end up in the default category. |
| 5 | Author: Michael D Adams |
| 6 | Version: demo |
| 7 | Author URI: http://blogwaffe.com/ |
| 8 | */ |
| 9 | |
| 10 | function 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 | |
| 20 | add_action('admin_head', 'uncheck_default_category'); |
| 21 | ?> |
| 22 |
