0

I am trying to edit a plugin that allows 1 taxonomy to be associated with a custom post type on import of data. I need it to have several custom taxonomies. Here is the original function:

/**
 * Initialize the class and set its properties.
 *
 * @since    1.0.0
 */
public function __construct() {

    $this->event_posttype = 'facebook_events';
    $this->taxonomy = 'classification';
    $this->tag_taxonomy = 'facebook_tag';

}

I have tried the following, which doesn't work.

    /**
 * Initialize the class and set its properties.
 *
 * @since    1.0.0
 */
public function __construct() {

    $this->event_posttype = 'facebook_events';
    $this->taxonomy = array(
                     'top_level_homepage_categories',
                     'another_category',
                     'subcategory',
                     'age_range',
                     'classification');
    $this->tag_taxonomy = 'facebook_tag';

}

input gratefully received, 1st time posting, hope I have done it right...

  • Wherever $this->taxonomy is used later on, possibly multiple times, the plugin likely doesn't account for there being multiple taxonomies. You would likely need to modify every instance of that property being used. – Jacob Peattie Mar 25 '18 at 13:46
  • thanks, I have found 2 instances, and by changing both $this->taxonomy = 'classification'; to $this->taxonomy = 'something-else'; I can change taxonomy used. I need to get all taxonomies displayed. – tonymu Mar 25 '18 at 16:11
  • It’s not an answer, but it’s worth mentioning, I guess... You should never modify plugins, themes or WP core. What will you do, when there will be new version of that plugin? ;) – Krzysiek Dróżdż Mar 25 '18 at 17:35
  • I hear what you are saying, I'll make a copy and keep it documented. I'll change name so it won't update. – tonymu Mar 25 '18 at 18:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.