Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Fulvio Notarstefano

    (@nekojira)

    Hello there,

    I’ve updated the Github repository to include V2 support: https://github.com/unfulvio/wp-api-menus

    I need to update the release on www.remarpro.com

    if you try out the one from GH and you find any incompatibility or room for improvement, feel free to submit a PR – so I will include that before the release

    Cheers

    Fulvio

    Thread Starter Okamoto Hidetaka

    (@hideokamoto)

    Thanks!
    I’ll try it ??

    Plugin Author Fulvio Notarstefano

    (@nekojira)

    Sorry just now I went to GitHub… I think 1.2.0 deployed here on WordPress should already include REST V2 support

    I neglected this plugin for a while as I was very busy – I’m going to do some test now and push an update with some latest commits and fixes from some PRs I had over GitHub

    Plugin Author Fulvio Notarstefano

    (@nekojira)

    Hello Hidetaka

    perhaps this is relevant to you:

    In V1 of the REST API the routes are located by default at wp-json/menus/ etc.

    In V2 the routes by default are at wp-json/wp-api-menus/v2/ (e.g. wp-json/wp-api-menus/v2/menus/, etc.) since V2 encourages prefixing and version namespacing.

    Thread Starter Okamoto Hidetaka

    (@hideokamoto)

    Thanks a lot !
    but now I try to GETwp-json/wp-api-menus/v2/menu-locations
    returned value has some PHP Notice.

    curl https://rest-api.dev/wp-json/wp-api-menus/v2/menu-locations
    <br />
    <font size='1'><table class='xdebug-error xe-notice' dir='ltr' border='1' cellspacing='0' cellpadding='1'>
    <tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> Notice: Undefined index: primary in /var/www/wordpress/wp-content/plugins/wp-api-menus/includes/wp-api-menus-v2.php on line <i>238</i></th></tr>
    <tr><th align='left' bgcolor='#e9b96e' colspan='5'>Call Stack</th></tr>
    <tr><th align='center' bgcolor='#eeeeec'>#</th><th align='left' bgcolor='#eeeeec'>Time</th><th align='left' bgcolor='#eeeeec'>Memory</th><th align='left' bgcolor='#eeeeec'>Function</th><th align='left' bgcolor='#eeeeec'>Location</th></tr>
    <tr><td bgcolor='#eeeeec' align='center'>1</td><td bgcolor='#eeeeec' align='center'>0.0009</td><td bgcolor='#eeeeec' align='right'>126580</td><td bgcolor='#eeeeec'>{main}(  )</td><td title='/var/www/wordpress/index.php' bgcolor='#eeeeec'>.../index.php<b>:</b>0</td></tr>
    <tr><td bgcolor='#eeeeec' align='center'>2</td><td bgcolor='#eeeeec' align='center'>0.0020</td><td bgcolor='#eeeeec' align='right'>128448</td><td bgcolor='#eeeeec'>require( <font color='#00bb00'>'/var/www/wordpress/wp-blog-header.php'</font> )</td><td title='/var/www/wordpress/index.php' bgcolor='#eeeeec'>.../index.php<b>:</b>17</td></tr>
    <tr><td bgcolor='#eeeeec' align='center'>3</td><td bgcolor='#eeeeec' align='center'>0.4978</td><td bgcolor='#eeeeec' align='right'>13487100</td><td bgcolor='#eeeeec'>wp(  )</td><td title='/var/www/wordpress/wp-blog-header.php' bgcolor='#eeeeec'>.../wp-blog-header.php<b>:</b>14</td></tr>
    <tr><td bgcolor='#eeeeec' align='center'>4</td><td bgcolor='#eeeeec' align='center'>0.4978</td><td bgcolor='#eeeeec' align='right'>13487172</td><td bgcolor='#eeeeec'>WP->main(  )</td><td title='/var/www/wordpress/wp-includes/functions.php' bgcolor='#eeeeec'>.../functions.php<b>:</b>952</td></tr>
    <tr><td bgcolor='#eeeeec' align='center'>5</td><td bgcolor='#eeeeec' align='center'>0.4978</td><td bgcolor='#eeeeec' align='right'>13487232</td><td bgcolor='#eeeeec'>WP->parse_request(  )</td><td title='/var/www/wordpress/wp-includes/class-wp.php' bgcolor='#eeeeec'>.../class-wp.php<b>:</b>679</td></tr>
    <tr><td bgcolor='#eeeeec' align='center'>6</td><td bgcolor='#eeeeec' align='center'>0.4986</td><td bgcolor='#eeeeec' align='right'>13505364</td><td bgcolor='#eeeeec'>do_action_ref_array(  )</td><td title='/var/www/wordpress/wp-includes/class-wp.php' bgcolor='#eeeeec'>.../class-wp.php<b>:</b>362</td></tr>
    <tr><td bgcolor='#eeeeec' align='center'>7</td><td bgcolor='#eeeeec' align='center'>0.4986</td><td bgcolor='#eeeeec' align='right'>13506016</td><td bgcolor='#eeeeec'><a href='https://www.php.net/function.call-user-func-array:{/var/www/wordpress/wp-includes/plugin.php:601}' target='_new'>call_user_func_array:{/var/www/wordpress/wp-includes/plugin.php:601}</a>
    (  )</td><td title='/var/www/wordpress/wp-includes/plugin.php' bgcolor='#eeeeec'>.../plugin.php<b>:</b>601</td></tr>
    <tr><td bgcolor='#eeeeec' align='center'>8</td><td bgcolor='#eeeeec' align='center'>0.4986</td><td bgcolor='#eeeeec' align='right'>13506060</td><td bgcolor='#eeeeec'>rest_api_loaded(  )</td><td title='/var/www/wordpress/wp-includes/plugin.php' bgcolor='#eeeeec'>.../plugin.php<b>:</b>601</td></tr>
    <tr><td bgcolor='#eeeeec' align='center'>9</td><td bgcolor='#eeeeec' align='center'>0.5845</td><td bgcolor='#eeeeec' align='right'>13808060</td><td bgcolor='#eeeeec'>WP_REST_Server->serve_request(  )</td><td title='/var/www/wordpress/wp-includes/rest-api.php' bgcolor='#eeeeec'>.../rest-api.php<b>:</b>172</td></tr>
    <tr><td bgcolor='#eeeeec' align='center'>10</td><td bgcolor='#eeeeec' align='center'>0.5850</td><td bgcolor='#eeeeec' align='right'>13811324</td><td bgcolor='#eeeeec'>WP_REST_Server->dispatch(  )</td><td title='/var/www/wordpress/wp-includes/rest-api/class-wp-rest-server.php' bgcolor='#eeeeec'>.../class-wp-rest-server.php<b>:</b>326</td></tr>
    <tr><td bgcolor='#eeeeec' align='center'>11</td><td bgcolor='#eeeeec' align='center'>0.5878</td><td bgcolor='#eeeeec' align='right'>13896044</td><td bgcolor='#eeeeec'><a href='https://www.php.net/function.call-user-func:{/var/www/wordpress/wp-includes/rest-api/class-wp-rest-server.php:861}' target='_new'>call_user_func:{/var/www/wordpress/wp-includes/rest-api/class-wp-rest-server.php:861}</a>
    (  )</td><td title='/var/www/wordpress/wp-includes/rest-api/class-wp-rest-server.php' bgcolor='#eeeeec'>.../class-wp-rest-server.php<b>:</b>861</td></tr>
    <tr><td bgcolor='#eeeeec' align='center'>12</td><td bgcolor='#eeeeec' align='center'>0.5878</td><td bgcolor='#eeeeec' align='right'>13896060</td><td bgcolor='#eeeeec'>WP_REST_Menus->get_menu_locations(  )</td><td title='/var/www/wordpress/wp-includes/rest-api/class-wp-rest-server.php' bgcolor='#eeeeec'>.../class-wp-rest-server.php<b>:</b>861</td></tr>
    </table></font>
    <br />
    <font size='1'><table class='xdebug-error xe-notice' dir='ltr' border='1' cellspacing='0' cellpadding='1'>
    <tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> Notice: Undefined index: social in /var/www/wordpress/wp-content/plugins/wp-api-menus/includes/wp-api-menus-v2.php on line <i>238</i></th></tr>
    <tr><th align='left' bgcolor='#e9b96e' colspan='5'>Call Stack</th></tr>
    <tr><th align='center' bgcolor='#eeeeec'>#</th><th align='left' bgcolor='#eeeeec'>Time</th><th align='left' bgcolor='#eeeeec'>Memory</th><th align='left' bgcolor='#eeeeec'>Function</th><th align='left' bgcolor='#eeeeec'>Location</th></tr>
    <tr><td bgcolor='#eeeeec' align='center'>1</td><td bgcolor='#eeeeec' align='center'>0.0009</td><td bgcolor='#eeeeec' align='right'>126580</td><td bgcolor='#eeeeec'>{main}(  )</td><td title='/var/www/wordpress/index.php' bgcolor='#eeeeec'>.../index.php<b>:</b>0</td></tr>
    <tr><td bgcolor='#eeeeec' align='center'>2</td><td bgcolor='#eeeeec' align='center'>0.0020</td><td bgcolor='#eeeeec' align='right'>128448</td><td bgcolor='#eeeeec'>require( <font color='#00bb00'>'/var/www/wordpress/wp-blog-header.php'</font> )</td><td title='/var/www/wordpress/index.php' bgcolor='#eeeeec'>.../index.php<b>:</b>17</td></tr>
    <tr><td bgcolor='#eeeeec' align='center'>3</td><td bgcolor='#eeeeec' align='center'>0.4978</td><td bgcolor='#eeeeec' align='right'>13487100</td><td bgcolor='#eeeeec'>wp(  )</td><td title='/var/www/wordpress/wp-blog-header.php' bgcolor='#eeeeec'>.../wp-blog-header.php<b>:</b>14</td></tr>
    <tr><td bgcolor='#eeeeec' align='center'>4</td><td bgcolor='#eeeeec' align='center'>0.4978</td><td bgcolor='#eeeeec' align='right'>13487172</td><td bgcolor='#eeeeec'>WP->main(  )</td><td title='/var/www/wordpress/wp-includes/functions.php' bgcolor='#eeeeec'>.../functions.php<b>:</b>952</td></tr>
    <tr><td bgcolor='#eeeeec' align='center'>5</td><td bgcolor='#eeeeec' align='center'>0.4978</td><td bgcolor='#eeeeec' align='right'>13487232</td><td bgcolor='#eeeeec'>WP->parse_request(  )</td><td title='/var/www/wordpress/wp-includes/class-wp.php' bgcolor='#eeeeec'>.../class-wp.php<b>:</b>679</td></tr>
    <tr><td bgcolor='#eeeeec' align='center'>6</td><td bgcolor='#eeeeec' align='center'>0.4986</td><td bgcolor='#eeeeec' align='right'>13505364</td><td bgcolor='#eeeeec'>do_action_ref_array(  )</td><td title='/var/www/wordpress/wp-includes/class-wp.php' bgcolor='#eeeeec'>.../class-wp.php<b>:</b>362</td></tr>
    <tr><td bgcolor='#eeeeec' align='center'>7</td><td bgcolor='#eeeeec' align='center'>0.4986</td><td bgcolor='#eeeeec' align='right'>13506016</td><td bgcolor='#eeeeec'><a href='https://www.php.net/function.call-user-func-array:{/var/www/wordpress/wp-includes/plugin.php:601}' target='_new'>call_user_func_array:{/var/www/wordpress/wp-includes/plugin.php:601}</a>
    (  )</td><td title='/var/www/wordpress/wp-includes/plugin.php' bgcolor='#eeeeec'>.../plugin.php<b>:</b>601</td></tr>
    <tr><td bgcolor='#eeeeec' align='center'>8</td><td bgcolor='#eeeeec' align='center'>0.4986</td><td bgcolor='#eeeeec' align='right'>13506060</td><td bgcolor='#eeeeec'>rest_api_loaded(  )</td><td title='/var/www/wordpress/wp-includes/plugin.php' bgcolor='#eeeeec'>.../plugin.php<b>:</b>601</td></tr>
    <tr><td bgcolor='#eeeeec' align='center'>9</td><td bgcolor='#eeeeec' align='center'>0.5845</td><td bgcolor='#eeeeec' align='right'>13808060</td><td bgcolor='#eeeeec'>WP_REST_Server->serve_request(  )</td><td title='/var/www/wordpress/wp-includes/rest-api.php' bgcolor='#eeeeec'>.../rest-api.php<b>:</b>172</td></tr>
    <tr><td bgcolor='#eeeeec' align='center'>10</td><td bgcolor='#eeeeec' align='center'>0.5850</td><td bgcolor='#eeeeec' align='right'>13811324</td><td bgcolor='#eeeeec'>WP_REST_Server->dispatch(  )</td><td title='/var/www/wordpress/wp-includes/rest-api/class-wp-rest-server.php' bgcolor='#eeeeec'>.../class-wp-rest-server.php<b>:</b>326</td></tr>
    <tr><td bgcolor='#eeeeec' align='center'>11</td><td bgcolor='#eeeeec' align='center'>0.5878</td><td bgcolor='#eeeeec' align='right'>13896044</td><td bgcolor='#eeeeec'><a href='https://www.php.net/function.call-user-func:{/var/www/wordpress/wp-includes/rest-api/class-wp-rest-server.php:861}' target='_new'>call_user_func:{/var/www/wordpress/wp-includes/rest-api/class-wp-rest-server.php:861}</a>
    (  )</td><td title='/var/www/wordpress/wp-includes/rest-api/class-wp-rest-server.php' bgcolor='#eeeeec'>.../class-wp-rest-server.php<b>:</b>861</td></tr>
    <tr><td bgcolor='#eeeeec' align='center'>12</td><td bgcolor='#eeeeec' align='center'>0.5878</td><td bgcolor='#eeeeec' align='right'>13896060</td><td bgcolor='#eeeeec'>WP_REST_Menus->get_menu_locations(  )</td><td title='/var/www/wordpress/wp-includes/rest-api/class-wp-rest-server.php' bgcolor='#eeeeec'>.../class-wp-rest-server.php<b>:</b>861</td></tr>
    </table></font>
    <br />
    <font size='1'><table class='xdebug-error xe-warning' dir='ltr' border='1' cellspacing='0' cellpadding='1'>
    <tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> Warning: Cannot modify header information - headers already sent by (output started at /var/www/wordpress/wp-content/plugins/wp-api-menus/includes/wp-api-menus-v2.php:238) in /var/www/wordpress/wp-includes/rest-api/class-wp-rest-server.php on line <i>1149</i></th></tr>
    <tr><th align='left' bgcolor='#e9b96e' colspan='5'>Call Stack</th></tr>
    <tr><th align='center' bgcolor='#eeeeec'>#</th><th align='left' bgcolor='#eeeeec'>Time</th><th align='left' bgcolor='#eeeeec'>Memory</th><th align='left' bgcolor='#eeeeec'>Function</th><th align='left' bgcolor='#eeeeec'>Location</th></tr>
    <tr><td bgcolor='#eeeeec' align='center'>1</td><td bgcolor='#eeeeec' align='center'>0.0009</td><td bgcolor='#eeeeec' align='right'>126580</td><td bgcolor='#eeeeec'>{main}(  )</td><td title='/var/www/wordpress/index.php' bgcolor='#eeeeec'>.../index.php<b>:</b>0</td></tr>
    <tr><td bgcolor='#eeeeec' align='center'>2</td><td bgcolor='#eeeeec' align='center'>0.0020</td><td bgcolor='#eeeeec' align='right'>128448</td><td bgcolor='#eeeeec'>require( <font color='#00bb00'>'/var/www/wordpress/wp-blog-header.php'</font> )</td><td title='/var/www/wordpress/index.php' bgcolor='#eeeeec'>.../index.php<b>:</b>17</td></tr>
    <tr><td bgcolor='#eeeeec' align='center'>3</td><td bgcolor='#eeeeec' align='center'>0.4978</td><td bgcolor='#eeeeec' align='right'>13487100</td><td bgcolor='#eeeeec'>wp(  )</td><td title='/var/www/wordpress/wp-blog-header.php' bgcolor='#eeeeec'>.../wp-blog-header.php<b>:</b>14</td></tr>
    <tr><td bgcolor='#eeeeec' align='center'>4</td><td bgcolor='#eeeeec' align='center'>0.4978</td><td bgcolor='#eeeeec' align='right'>13487172</td><td bgcolor='#eeeeec'>WP->main(  )</td><td title='/var/www/wordpress/wp-includes/functions.php' bgcolor='#eeeeec'>.../functions.php<b>:</b>952</td></tr>
    <tr><td bgcolor='#eeeeec' align='center'>5</td><td bgcolor='#eeeeec' align='center'>0.4978</td><td bgcolor='#eeeeec' align='right'>13487232</td><td bgcolor='#eeeeec'>WP->parse_request(  )</td><td title='/var/www/wordpress/wp-includes/class-wp.php' bgcolor='#eeeeec'>.../class-wp.php<b>:</b>679</td></tr>
    <tr><td bgcolor='#eeeeec' align='center'>6</td><td bgcolor='#eeeeec' align='center'>0.4986</td><td bgcolor='#eeeeec' align='right'>13505364</td><td bgcolor='#eeeeec'>do_action_ref_array(  )</td><td title='/var/www/wordpress/wp-includes/class-wp.php' bgcolor='#eeeeec'>.../class-wp.php<b>:</b>362</td></tr>
    <tr><td bgcolor='#eeeeec' align='center'>7</td><td bgcolor='#eeeeec' align='center'>0.4986</td><td bgcolor='#eeeeec' align='right'>13506016</td><td bgcolor='#eeeeec'><a href='https://www.php.net/function.call-user-func-array:{/var/www/wordpress/wp-includes/plugin.php:601}' target='_new'>call_user_func_array:{/var/www/wordpress/wp-includes/plugin.php:601}</a>
    (  )</td><td title='/var/www/wordpress/wp-includes/plugin.php' bgcolor='#eeeeec'>.../plugin.php<b>:</b>601</td></tr>
    <tr><td bgcolor='#eeeeec' align='center'>8</td><td bgcolor='#eeeeec' align='center'>0.4986</td><td bgcolor='#eeeeec' align='right'>13506060</td><td bgcolor='#eeeeec'>rest_api_loaded(  )</td><td title='/var/www/wordpress/wp-includes/plugin.php' bgcolor='#eeeeec'>.../plugin.php<b>:</b>601</td></tr>
    <tr><td bgcolor='#eeeeec' align='center'>9</td><td bgcolor='#eeeeec' align='center'>0.5845</td><td bgcolor='#eeeeec' align='right'>13808060</td><td bgcolor='#eeeeec'>WP_REST_Server->serve_request(  )</td><td title='/var/www/wordpress/wp-includes/rest-api.php' bgcolor='#eeeeec'>.../rest-api.php<b>:</b>172</td></tr>
    <tr><td bgcolor='#eeeeec' align='center'>10</td><td bgcolor='#eeeeec' align='center'>0.5914</td><td bgcolor='#eeeeec' align='right'>13835912</td><td bgcolor='#eeeeec'>WP_REST_Server->send_headers(  )</td><td title='/var/www/wordpress/wp-includes/rest-api/class-wp-rest-server.php' bgcolor='#eeeeec'>.../class-wp-rest-server.php<b>:</b>357</td></tr>
    <tr><td bgcolor='#eeeeec' align='center'>11</td><td bgcolor='#eeeeec' align='center'>0.5914</td><td bgcolor='#eeeeec' align='right'>13836140</td><td bgcolor='#eeeeec'>WP_REST_Server->send_header(  )</td><td title='/var/www/wordpress/wp-includes/rest-api/class-wp-rest-server.php' bgcolor='#eeeeec'>.../class-wp-rest-server.php<b>:</b>1162</td></tr>
    <tr><td bgcolor='#eeeeec' align='center'>12</td><td bgcolor='#eeeeec' align='center'>0.5914</td><td bgcolor='#eeeeec' align='right'>13836488</td><td bgcolor='#eeeeec'><a href='https://www.php.net/function.header' target='_new'>header</a>
    (  )</td><td title='/var/www/wordpress/wp-includes/rest-api/class-wp-rest-server.php' bgcolor='#eeeeec'>.../class-wp-rest-server.php<b>:</b>1149</td></tr>
    </table></font>
    {"primary":{"ID":null,"label":"\u30e1\u30a4\u30f3\u30e1\u30cb\u30e5\u30fc","meta":{"links":{"collection":"http:\/\/rest-api.dev\/wp-json\/wp\/v2\/menu-locations\/","self":"http:\/\/rest-api.dev\/wp-json\/wp\/v2\/menu-locations\/primary"}}},"social":{"ID":null,"label":"\ufeff\u30bd\u30fc\u30b7\u30e3\u30eb\u30ea\u30f3\u30af\u30e1\u30cb\u30e5\u30fc","meta":{"links":{"collection":"http:\/\/rest-api.dev\/wp-json\/wp\/v2\/menu-locations\/","self":"http:\/\/rest-api.dev\/wp-json\/wp\/v2\/menu-locations\/social"}}}}%
    Thread Starter Okamoto Hidetaka

    (@hideokamoto)

    Test Env info.

    [vagrant@rest-api wordpress]$ wp plugin list
    +------------------------------+----------+--------+------------+
    | name                         | status   | update | version    |
    +------------------------------+----------+--------+------------+
    | akismet                      | inactive | none   | 3.1.7      |
    | dynamic-hostname             | active   | none   | 0.4.2      |
    | hello                        | inactive | none   | 1.6        |
    | matts-community-tags         | inactive | none   | 0.4        |
    | rest-api-widgets             | active   | none   | 0.1        |
    | tinymce-templates            | active   | none   | 4.4.3      |
    | wordpress-importer           | active   | none   | 0.6.1      |
    | wpapi-shortcodes-and-widgets | active   | none   | 2.0.0      |
    | wp-multibyte-patch           | active   | none   | 2.5        |
    | rest-api                     | active   | none   | 2.0-beta10 |
    | json-rest-api                | inactive | none   | 1.2.5      |
    | OAuth1                       | active   | none   | 0.2.1      |
    | wp-api-menus                 | active   | none   | 1.2.1      |
    | wp-total-hacks               | active   | none   | 2.0.1      |
    +------------------------------+----------+--------+------------+
    [vagrant@rest-api wordpress]$ wp core version
    4.4.1

    Plugin Author Fulvio Notarstefano

    (@nekojira)

    Hey,

    I made a new commit just now… It seems while looping menu items it can’t find an array key – if I introduce a check for this it will suppress the error but it’s likely you will be missing items – we need to figure out why the key wasn’t found

    about the headers already sent, this error is probably due to the fact you had html printed because of the previous 2 errors

    Thread Starter Okamoto Hidetaka

    (@hideokamoto)

    I try to re-setup wordpress env using vccw,but I can’t reproduce the error.
    Now i can get json data.

    thanks ??

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘WP REST API Version2’ is closed to new replies.