• Hi all I have been impletmenting taxonomies to users called ‘profession’ and then they assign themselves different cathegories.

    For a while the template for the taxonomy worked, now no more..

    Upon open the page for specific taxonomy ‘profession/artist/’, now i receive this error:

    Uncaught Error: Call to undefined method stdClass::get_rest_controller()
    in …/wp-includes/rest-api.php on line 2209

    Call stack:

    rest_get_route_for_term()
    wp-includes/rest-api.php:2245
    rest_get_queried_resource_route()
    wp-includes/rest-api.php:943
    rest_output_link_header()
    wp-includes/class-wp-hook.php:285
    WP_Hook::apply_filters()
    wp-includes/class-wp-hook.php:311
    WP_Hook::do_action()
    wp-includes/plugin.php:478
    do_action()
    wp-includes/template-loader.php:13
    require_once()
    wp-blog-header.php:19
    require()
    index.php:17

    And this is how I registered the taxonomy:

    register_taxonomy('profession', 'user', array(
      'public'        =>true,
      'single_value' => false,
      'show_admin_column' => true,
      'labels'        =>array(
          'name'                      =>'Professions',
          'singular_name'             =>'Profession',
          'menu_name'                 =>'Professions',
          'search_items'              =>'Search Professions',
          'popular_items'             =>'Popular Professions',
          'all_items'                 =>'All Professions',
          'edit_item'                 =>'Edit Profession',
          'update_item'               =>'Update Profession',
          'add_new_item'              =>'Add New Profession',
          'new_item_name'             =>'New Profession Name',
          'separate_items_with_commas'=>'Separate professions with commas',
          'add_or_remove_items'       =>'Add or remove professions',
          'choose_from_most_used'     =>'Choose from the most popular professions',
      ),
      'query_var' => true,
      'rewrite'       =>array(
          'with_front'                =>true,
          'slug'                      =>'profession',
      ),
      'capabilities'  => array(
          'manage_terms'              =>'edit_users',
          'edit_terms'                =>'edit_users',
          'delete_terms'              =>'edit_users',
          'assign_terms'              =>'read',
      ),
    ));

    also I am using the lh-user-taxonomy plugin that helps me better save the taxonomy to the user I had problems updating before.

    I am working on a local installation I don’t know if that influences.

    Thank you.

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    WP is becoming more and more dependent upon the API. For your taxonomy to be available to the API, include the 'show_in_rest'=> true, arg when you register.

Viewing 1 replies (of 1 total)
  • The topic ‘Rest api error on calling taxonomy’ is closed to new replies.