• Resolved David Bravo

    (@bohemme)


    Hi:

    I’m finishing a theme in which users represent to companies selling products. I’ve successfully added some cmb2 boxes (types: text, title, file and textarea) but I also need users have custom taxonomies, which I’ve defined with Types plugin.
    I’ve used this code to create one of this selection taxonomies:

    $cmb->add_field( array(
    		'name' => __( 'Company Category', 'guia_colegios' ),
    		'desc' => 'Categoría o categorías a la que pertenece la empresa',
    		'id' => HORIZON_USER_PREFIX . 'categoria_empresa',
    		'taxonomy' => 'categoria-solicitud', //Enter Taxonomy Slug
    		'type' => 'taxonomy_multicheck',
    		'select_all_button' => false
    	) );

    And, thought this taxonomy is applied to another custom post type, it renders perfectly in the admin page, and saves the selection from here.
    The problem is that I need to access to asigned taxonomies values from front page, to make a custom search but I can’t find a way to access to that info. I’ve tried all I’ve found, from get_terms, from custom queries from everything.
    In my theme’s user template, I access all user’s custom fields (there are a lot, as this user has all billing info, custom images, custom files, and so on) EXCEPT this taxonomy fields, using
    get_user_meta(). I can var_dump() all his info but this two fields.
    How can I access to this info.
    Thanks, I’ve been hitting my head with this for 3 days and see no other option. As I said, this fields (as menu dropdown or multicheck boxes) appear and stores correctly in admin.

    https://www.ads-software.com/plugins/cmb2/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter David Bravo

    (@bohemme)

    Well, I mostly made it. Using LH User Taxonomies Plugin I then created these two custom taxonomies that are feeding CMB2 select and checkbox fields, so maybe not the best solution but at least I can access this data from front end.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    I have to believe the term IDs were being stored as part of the user data, but I don’t have a var_dump() of all the user meta you’re saving to confirm.

    If I had that much, I could help you out with using that info on the frontend.

    Thread Starter David Bravo

    (@bohemme)

    Thanks for answering, Michael. In user data there were no term IDs nor slugs nor anything refered to those taxonomies. Now, having created custom taxonomies for users, they do appear and I can use them to filter content. I think maybe I was twisting a bit WP’s inner workings, but I was doubtful as these taxonomies did appear in Admin panel showing the correct values. ??
    Anyway, I’ve solved in a cleaner way, I think. ??

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Sounds good. Thanks for the update, regardless.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Can't access Taxonomy_multicheck data for user’ is closed to new replies.