Support » Plugins » How to insert new categories into database from a plugin

  • Resolved narken



    Im trying to make a new pluing that automatically makes a post everyday with weather information from around the world.

    Every works fine except I would like to also create new categories from within the plugin either by a wp function or directly into the database. Sometimes the category might already be there sometimes not and I would then have to create it.

    Is there a function to add a category or do I have to put it directly into the database ?

Viewing 1 replies (of 1 total)
  • There is a function to add category in wp-admin\taxonomy.php and it is called from wp-admin/categories.php
    The function: wp_insert_category($_POST)
    Look at Categories in Dashboard and learn which variable to POST. You can find them in Add Category Form by looking source code of this page.
    (Sorry, for my poor English)

Viewing 1 replies (of 1 total)
  • The topic ‘How to insert new categories into database from a plugin’ is closed to new replies.