Custom Fields all have the same data in a Custom Post Type
-
Howdy,
I’ve installed the plug-in and successfully exposed an API end point for a CPT, including a handful of custom fields in the response. All custom fields display the same data, the first custom field generated:
Incorrect output:
project_client":"acme Inc.","project_title":"acme Inc.","project_lead_paragraph":"acme Inc.","project_brief_description":"acme Inc.","project_long_description":"acme Inc.",
As you can see – “acme Inc.” is the value of ALL project_ fields. Each db field contains the correct value, but each custom field uses the value of first custom field at this API endpoint.
Debug on my local and web apache servers shows the following error when pinging a specific item:
Notice: Undefined variable: plugin in /Users/a/Sites/acme/app/wp-content/plugins/wp-rest-api-controller/includes/class-wp-rest-api-controller.php on line 78
Warning: Creating default object from empty value in /Users/a/Sites/acme/app/wp-content/plugins/wp-rest-api-controller/includes/class-wp-rest-api-controller.php on line 265
Notice: Undefined property: stdClass::$publicly_queryable in /Users/a/Sites/acme/app/wp-includes/post.php on line 1708
Notice: Undefined property: stdClass::$_builtin in /Users/a/Sites/acme/app/wp-includes/post.php on line 1708
Warning: Cannot modify header information – headers already sent by (output started at /Users/a/Sites/acme/app/wp-content/plugins/wp-rest-api-controller/includes/class-wp-rest-api-controller.php:78) in /Users/a/Sites/acme/app/wp-includes/rest-api/class-wp-rest-server.php on line 1196
Warning: Cannot modify header information – headers already sent by (output started at /Users/a/Sites/acme/app/wp-content/plugins/wp-rest-api-controller/includes/class-wp-rest-api-controller.php:78) in /Users/a/Sites/acme/app/wp-includes/rest-api/class-wp-rest-server.php on line 1196
Warning: Cannot modify header information – headers already sent by (output started at /Users/a/Sites/acme/app/wp-content/plugins/wp-rest-api-controller/includes/class-wp-rest-api-controller.php:78) in /Users/a/Sites/acme/app/wp-includes/rest-api/class-wp-rest-server.php on line 1196
Warning: Cannot modify header information – headers already sent by (output started at /Users/a/Sites/acme/app/wp-content/plugins/wp-rest-api-controller/includes/class-wp-rest-api-controller.php:78) in /Users/a/Sites/acme/app/wp-includes/rest-api/class-wp-rest-server.php on line 1196
Warning: Cannot modify header information – headers already sent by (output started at /Users/a/Sites/acme/app/wp-content/plugins/wp-rest-api-controller/includes/class-wp-rest-api-controller.php:78) in /Users/a/Sites/acme/app/wp-includes/rest-api/class-wp-rest-server.php on line 1196
Warning: Cannot modify header information – headers already sent by (output started at /Users/a/Sites/acme/app/wp-content/plugins/wp-rest-api-controller/includes/class-wp-rest-api-controller.php:78) in /Users/a/Sites/acme/app/wp-includes/rest-api/class-wp-rest-server.php on line 1196
Warning: Cannot modify header information – headers already sent by (output started at /Users/a/Sites/acme/app/wp-content/plugins/wp-rest-api-controller/includes/class-wp-rest-api-controller.php:78) in /Users/a/Sites/acme/app/wp-includes/rest-api/class-wp-rest-server.php on line 1196
Warning: Cannot modify header information – headers already sent by (output started at /Users/a/Sites/acme/app/wp-content/plugins/wp-rest-api-controller/includes/class-wp-rest-api-controller.php:78) in /Users/a/Sites/acme/app/wp-includes/rest-api/class-wp-rest-server.php on line 1196
Warning: Cannot modify header information – headers already sent by (output started at /Users/a/Sites/acme/app/wp-content/plugins/wp-rest-api-controller/includes/class-wp-rest-api-controller.php:78) in /Users/a/Sites/acme/app/wp-includes/rest-api/class-wp-rest-server.php on line 1196
Warning: Cannot modify header information – headers already sent by (output started at /Users/a/Sites/acme/app/wp-content/plugins/wp-rest-api-controller/includes/class-wp-rest-api-controller.php:78) in /Users/a/Sites/acme/app/wp-includes/rest-api/class-wp-rest-server.php on line 1196
Full output:
{"id":727,"date":"2016-07-13T12:21:53","date_gmt":"2016-07-13T16:21:53","guid":{"rendered":"http:\/\/acme.dev\/?post_type=our-works&p=727"},"modified":"2016-07-13T12:21:53","modified_gmt":"2016-07-13T16:21:53","slug":"title-in-wordpress-doesnt-get-listed-on-the-website","type":"our-works","link":"http:\/\/acme.dev\/our-works\/title-in-wordpress-doesnt-get-listed-on-the-website\/","title":{"rendered":"Title in WordPress, doesn’t get listed on the website"},"featured_media":0,"categories":[17],"project_client":"acme Inc.","project_title":"acme Inc.","project_lead_paragraph":"acme Inc.","project_brief_description":"acme Inc.","project_long_description":"acme Inc.","_links":{"self":[{"href":"http:\/\/acme.dev\/wp-json\/wp\/v2\/our-works\/727"}],"collection":[{"href":"http:\/\/acme.dev\/wp-json\/wp\/v2\/our-works"}],"about":[{"href":"http:\/\/acme.dev\/wp-json\/wp\/v2\/types\/our-works"}],"wp:attachment":[{"href":"http:\/\/acme.dev\/wp-json\/wp\/v2\/media?parent=727"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/acme.dev\/wp-json\/wp\/v2\/categories?post=727"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}
Any idea what could be up with these 2 issues, and if they are related? Suppressing the error message is not the end of the world – if the data was accurate.
https://www.ads-software.com/plugins/wp-rest-api-controller/
- The topic ‘Custom Fields all have the same data in a Custom Post Type’ is closed to new replies.