factor1 / better-rest-endpoints

A WordPress plugin that serves up slimmer WP Rest API endpoints.
https://wordpress.org/plugins/better-rest-endpoints/
GNU General Public License v3.0
67 stars 25 forks source link

ACF Post Object not returning permalink #24

Closed joshuaiz closed 6 years ago

joshuaiz commented 6 years ago

Hello,

I'm not sure if this is even an issue with BRE or not but when retrieving custom post type posts with ACF Post Object fields, I'm getting the post objects array but the data does not include the post object/post permalink.

Is there a way to add the post object permalink endpoint to BRE programmatically?

Thanks!

erwstout commented 6 years ago

Hi @joshuaiz! Let me set up a quick test environment and look into this for you. I'll get back to you shortly. I can't recall off the top of my head if its provided by ACF or if BRE is just not providing that in the response.

joshuaiz commented 6 years ago

@erwstout great thanks. I tried to research this but the Googles were not helping.

erwstout commented 6 years ago

So using get_fields() on a post that uses the Post Object field, you can see that ACF itself does not return a permalink, just the ID. So its related to ACF itself.

Array ( [a_test_post_object] => WP_Post Object ( [ID] => 1 [post_author] => 1 [post_date] => 2018-08-22 01:59:50 [post_date_gmt] => 2018-08-22 01:59:50 [post_content] => Welcome to WordPress. This is your first post. Edit or delete it, then start writing! [post_title] => Hello world! [post_excerpt] => [post_status] => publish [comment_status] => open [ping_status] => open [post_password] => [post_name] => hello-world [to_ping] => [pinged] => [post_modified] => 2018-08-22 01:59:50 [post_modified_gmt] => 2018-08-22 01:59:50 [post_content_filtered] => [post_parent] => 0 [guid] => http://bre-testing.local/?p=1 [menu_order] => 0 [post_type] => post [post_mime_type] => [comment_count] => 1 [filter] => raw ) ) 11