Events Manager
EM ver 5 Beta 1 - Category ID Issue (5 posts)

  1. rontarson
    Posted 4 years ago #

    What am doing wrong on pulling category ID's in ver 5. Looks like this changed but not familiar enough to understand how to change it going forward.

    Here is what I had in EM ver 4

    global $EM_Category;
    $catname = $EM_Category->name; //get category name and store it
    $currentid = $EM_Category->id; //get and store the current category id

    $EM_Category->name; still pulls the category name but $EM_Category->id; does not pull the id.


  2. agelonwl
    Posted 4 years ago #


    try to use $EM_Category->term_id

  3. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 4 years ago #

    yes, now EM_Category is basically an extension of the object you get when you do get_term(), with added methods for use in EM

    I'll make id = term_id just to avoid unecessary confusion in next beta, but if you can use term_id, better :=)

    similar concept in Event and Location objects, they should contain all post object fields alongside EM specific properties/methods.

  4. rontarson
    Posted 4 years ago #

    So to continue on the below should be modified to $EM_Event->term_id; but what about get_categories() and get_ids()? Are these being updated as well?

    if (class_exists('EM_Events')) {
    	$currentid = $EM_Event->id; //get and store the current event id
    	$cats = $EM_Event->get_categories(); //get the categories for the current event
    	$cat_ids = $cats->get_ids(); //get the ids for the categories of the current event
    	$cat_ids_strg = implode(',', $cat_ids); //make a comma separated string of category ids
  5. agelonwl
    Posted 4 years ago #


    get_categories() and get_ids() should be the same. Please advice if it doesn't work!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Events Manager
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic