Web Hosting
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

WordPress fix rest-api

Discussion in 'Misc WordPress Requests' started by ldco2016, Oct 29, 2017.

  1. ldco2016

    Guest

    rest-api, by ldco2016

    I am developing a WordPress theme with Angular.

    I have connected Angularjs with WordPress using ng-repeat to display a list of WordPress posts in templates/list.html:

    <h1>{{page_title}}</h1>

    <article ng-repeat="post in posts">
    <h2>{{post.title.rendered}}</h2>
    <div ng-bind-html="post.content.rendered | to_trusted"></div>
    <a ui-sref="detail({id: post.id})">Click here to read more</a>
    </article>

    I created a single post template and route and connecting the two views both single and post. Now I want to add custom data to the API response and displaying it. To do that I add:

    function register_new_field() {}

    inside of functions.php. It’s when I start this:

    function register_new_field() {
    register_api_field();
    }

    that this error begins to occur:

    Error: $resource:badcfg
    Response does not match configured parameter

    rest-api
     
    #1

Share This Page

Web Hosting