WordPress.org

Ready to get started?Download WordPress

Forums

Version Safe Category Checking (1 post)

  1. srp0uk
    Member
    Posted 6 years ago #

    Hi all, what is the best version safe way of checking that a category exists and then maybe inserting a new category from within a plugin?

    I have read that using the API to do this is the best way, the function category_exists() - there is just one problem with this though.

    This is in the admin functions, and so when the plugin is triggered by a 'normal' surfer, the admin functions havent been called and relevant permissions arent set, so I get the error message Fatal error: Call to undefined function: category_exists()

    So, do I need to write entirely new functions, one for version 2.3 and one for 2.2 and lower, or is there another API function that I have overlooked?

    Thanks...

Topic Closed

This topic has been closed to new replies.

About this Topic