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