Support » Plugin: WP-REST-API V2 Menus » Equivalent to ‘object_slug’ in new plugin version

  • Hi there.
    The old API exposed a property called object_slug which we rely on.
    Actually I think a lot of people may need this.
    We use the advantage of a REST API togehter with Vue and to use a vue router-link we can’t pass in the whole url together with the domain. So the bare object_slug came in very handy.
    Now in the new API there is nothing alike, am I correct?

    Why was it removed and could it be re-added?
    Thank you

    Cheers

    • This topic was modified 4 months, 3 weeks ago by nr2012.
Viewing 3 replies - 1 through 3 (of 3 total)
  • dicktornfeldt

    (@dicktornfeldt)

    Same problem here. I used this plugin in order to get object_slug using it in a Gatsby menu. Now I need to do an ugly rewrite in order to make it work.

    Same issues. Shouldn’t have to do a rewrite. Should have kept it or at least provided a reason for removing

    The solution that worked for me:

    `…
    ‘object_slug’ =>
    (isset(get_post($item[‘object_id’])->post_name)
    &&
    !empty(get_post($item[‘object_id’])->post_name))
    ?
    get_post($item[‘object_id’])->post_name
    :
    null,
    …`

    sorry, wrong plugin 🙂

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