How to Pre-Select a Category for a New Post

Lets say you have a category called “X”, and you want to create a link which when clicked will take the user to the “Add New Post” screen with the “X” category already selected. This could be used to simplify posting for non-technical users, or even as a way to implement “poor-man’s custom post types” of sorts, with categories instead of true CPTs.

To make this possible, you’ll need a way to set the post category via the URL. The following snippet lets you do just that. Simply append a category_id=123 parameter to the post editor URL, and it wi

Leave a Reply

Your email address will not be published.