Say you have a bunch of categories, and you’d like the one that’s checked by default whenever you launch a new post to be something other than your catch-all category. (For example, if you’d like it to be somethat that doesn’t get swamped by posts from a deleted category.)

To find out how to do it in WordPress 1.5.x, read these simple yet utterly baffling instructions:

  • In your WordPress control panel, navigate to “Manage” and “Categories”. Read the ID number of the category that’s going to be your new checked-by-default category. Memorize it. (If you have a moment, write it down and place it in a secure place, like in a safety deposit box or on top of a shelf nobody cleans very often. Be sure to mention it in your will; years from now, you don’t want your kids fighting over who gets that ID number.)
  • Back up wp-admin/edit-form.php. Give the backup a new name like “edit-form.php.original.” (Don’t call it “edit-form.php.old,” because computer files tend to be very insecure about their age. If it seems a little down, call it “edit-form.php.supercoolfile”. A little kindness goes a long way in this business.)
  • Open your newly-duplicated edit-form.php in your favourite text editor. (Just in case you thought, “Hmm, since he didn’t actually specify a particular text editor, he must want me to use one I really hate.“)
  • Scroll down to Line 30, which reads
    ⟨? php dropdown_categories($default_post_cat);?⟩

  • If someone is watching over your shoulder, nod sagely and pretend to know what Line 30 means.
  • Insert a new line before Line 30, reading ⟨? php $default_post_cat =(that post category ID number you memorized)?⟩ For instance, if your category’s ID number is 5, that line would read ⟨? php $default_post_cat=5; ?⟩ Or, if your category’s ID number is 867-5309, then Jenny, I got your number.
  • Don’t cut and paste the new line from this page, by the way. WordPress has managed to thwart my every effort to insert proper angle brackets in this post; you’ll only get something weird.
  • Save and upload your file. No! Not to that directory! To wp-admin! Too late — it’s ruined!
  • Test your newly hacked installation of WordPress by creating a new post and seeing if your new default category is automatically checked for you. Or, alternately, whether this hack has turned WordPress into a monstrous killing machine. If so, my bad.
  • Spend the next three days Googling for a plug-in that does this quickly and easily. When you find one, and I know you will, come back here and post a sneering, condescending comment.

And that’s all there is to it! Until the next incremental upgrade of WordPress, of course, when you’ll have to do this all over again.

Mastodon