Create a post automatically associated to a category in wordpress


Hello guys I have many categories (Press release, News letter, Media Resources )when the client wants to create a Pressrelease post the one has to associate the post with that category, is there a way with code or a plugin to say “Add Press release” and create a post automatically associated to the category, or preselect the category?

Something like that?

enter image description here

Im using this code:

// Preselect category

function ws_preselect_post_category() {
    if ( isset($_GET['category_id']) && is_numeric($_GET['category_id']) ) {
        $catId = intval($_GET['category_id']);
        <script type="text/javascript">
            jQuery(function() {
                var catId = <?php echo json_encode($catId); ?>;
                jQuery('#in-category-' + catId).click();
add_action('admin_footer-post-new.php', 'ws_preselect_post_category');

function ws_add_new_post_link() {
        'Add New JS Article',
        'Add New JS Article',
add_action('admin_menu', 'ws_add_new_post_link');
kelvin ramirez 4 months 0 Answers 10 views 0

Leave an answer