Support » Fixing WordPress » rest-api

  • 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
Viewing 1 replies (of 1 total)
  • Tim Nash

    (@tnash)

    Spam hunter

    The error is being generated by Angular rather then WordPress and appears to be because its failing to retrieve the data. It could be you got the wrong URL or parameters that your trying to retrieve.

    • This reply was modified 2 years, 6 months ago by Tim Nash.
Viewing 1 replies (of 1 total)
  • The topic ‘rest-api’ is closed to new replies.