• Resolved nunziorash

    (@nunziorash)


    Hi, I’m trying to get cmb2 working in wordpress rest api, but unfortunately without luck.
    I have enabled the display in the rest api as indicated in the documentation:

    $opzioni_pagina = new_cmb2_box( array(
    'id' => $prefix . 'metabox',
    'title' => __( 'Opzioni', 'cmb2' ),
    'object_types' => array( 'servizi' ),
    'context' => 'normal',
    'priority' => 'high',
    'show_names' => true,
    'show_in_rest' => WP_REST_Server::ALLMETHODS,
    ) );
    $opzioni_pagina->add_field( array(
    'name' => 'Sottotitolo',
    'id' => $prefix . 'sottotitolo',
    'type' => 'text',
    'sanitization_cb' => 'prefix_sanitize_text_callback',
    'show_in_rest' => WP_REST_Server::ALLMETHODS,
    ) );

    but when i go to call the url in get https://site.ext/wp-json/cmb2/v1/boxes, i get a 404:

    {“code”:”rest_no_route”,”message”:”Nessun percorso fornisce una corrispondenza tra l’URL ed il metodo richiesto.”,”data”:{“status”:404}}

    what am I doing wrong?

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘cmb2 and wp-json’ is closed to new replies.