Adding category to event in PHP
-
We have been programmatically adding categories to events in some cases for the last couple of years. However, since the last big Events Manager update, the following code does not work anymore.
$EM_Event->categories = new EM_Categories(); // On an unsaved event with no categories foreach ( $categories_to_add as $category_id ) { $EM_Event->categories->categories[$category_id] = new EM_Category( $category_id ); }
It raises the following PHP notice:
Notice: Indirect modification of overloaded property EM_Categories::$categories has no effect in
, referring to the line inside the foreach.How to add categories to an event in PHP in Events Manager 5.8?
Viewing 15 replies - 1 through 15 (of 15 total)
Viewing 15 replies - 1 through 15 (of 15 total)
- The topic ‘Adding category to event in PHP’ is closed to new replies.