Could not retrieve a taxonomy block type data

Support MB Blocks Could not retrieve a taxonomy block type dataResolved

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #38289
    WilhemWilhem
    Participant

    Hello !

    Can you help me with that ?

    Block:

    
    function waff_blocks_register_meta_boxes( $meta_boxes ) {
    	$prefix = 'waff_';
    
    	// WA Partners
    	$meta_boxes[] = [
    		'title'           => esc_html__( '(WA) Partners', 'waff' ),
    		'id'              => 'wa-partners',
    		'fields'          => [
    			[
    				'id'         => $prefix . 'pn_categories',
    				'type'       => 'taxonomy',
    				'name'       => esc_html__( 'Select categories', 'waff' ),
    				'taxonomy'   => array('partenaire-category'),
    				'desc'       => esc_html__( 'Choose to display those categories. If empty, none of the categories will be displayed.', 'waff' ),
    				'field_type' => 'checkbox_list',
    				'multiple' => true,
    				'select_all_none' => true,
    				'query_args'  => array(
    					'post_status'    => 'publish',
    					'posts_per_page' => -1,
    				),
    				//'hidden' => array( $prefix . 'lp_posttype', '!=', 'post' ),
    			],	
    		
    		],
    		'category'        => 'layout',
    		'icon'            => 'megaphone',
    		'description'     => esc_html__( 'Display the current edition partners', 'waff' ),
    		'keywords'        => ['partners', 'posts', 'partner', 'logotype'],
    		'supports'        => [
    			'anchor'          => true,
    			'customClassName' => true,
    			'align'           => ['wide'], // left, center, right, 
    		],
    		'render_callback' => 'WaffTwo\Blocks\wa_partners_callback',
    		'type'            => 'block',
    		'context'         => 'side',
    	];
    
            ...
    
    

    Render:

    
    function wa_partners_callback( $attributes, $is_preview = false, $post_id = null ) {
    
    ...
    print_r(mb_get_block_field( 'waff_pn_categories' )); // Could not retrieve taxonomy datas
    ...
    
    

    Front:
    Array( ) is always empty..

    Thanks a lot,
    Wilhem

    #38300
    Long NguyenLong Nguyen
    Moderator

    Hi,

    Please use the field taxonomy_advanced instead of taxonomy in a block. Please refer to this topic https://support.metabox.io/topic/not-show-taxonomy-field-values-in-mb-blocks/

    #38306
    WilhemWilhem
    Participant

    Thanks a lot !

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.