The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Removing nested JSON fields from WP-API.

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
  • #206602


    After reading the Using the WP-API to Fetch Posts article,, I found the unset feature very useful to switch off fields that were not needed, however, I was wondering if someone knew how to remove nested fields.

    For example, adding unset( $data['author'] ); will remove the full set of Author information, such as the First Name, Last Name, Nickname, Avatar, etc.

    I have tried adding unset( $data['author']['first_name' ); but to no avail. The name still remains in the JSON code.

    Is there a way to remove just the 'first_name' of the author field?



Viewing 1 post (of 1 total)
  • The forum ‘Back End’ is closed to new topics and replies.