• Resolved Quint

    (@qrahaman)


    If I disable visibility to the post type and use the endpoint url, a 404 is returned. That response is correct. If I enable the post type and use the endpoint url, no meta fields should show since the default visibility is set to “off” for all fields. Unfortunately, all meta fields are returned. I have tried on two different sites with the same result. I have turned on/off different fields and get the same result–everything is returned.

    Any troubleshooting advice?

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Contributor yikesitskevin

    (@yikesitskevin)

    Hi @qrahaman,

    Which endpoint is returning all the meta fields? Is it the standard CPT endpoint?

    Also, are you using any other REST API plugins?

    Let me know,
    Kevin.

    Thread Starter Quint

    (@qrahaman)

    @yikesitskevin,

    Thanks for responding, Kevin. It’s my PODS custom post type. I do not have any other REST API plugins running. I have four active plugins: yours, Pods, an Under Construction plugin (which I’ve turned off/on, no change), and my own.

    If you provide an email address, I can provide Admin access should you want to take a look.

    Cheers,

    Quint.

    Plugin Contributor yikesitskevin

    (@yikesitskevin)

    Hey Quint,

    Sounds good – email me at kevin at yikesinc dot com.

    Thread Starter Quint

    (@qrahaman)

    Done. Thank you!

    Plugin Contributor yikesitskevin

    (@yikesitskevin)

    Hi Quint,

    So I logged in, verified the issue, and did some research on the PODS plugin. Apparently PODS does a lot (and more, really) of what our plugin does. If you go to your Calibrations post type in the PODS Admin screen, you’ll see a REST API section. In this section there is a checkbox for “Show all fields.” This means all of your meta fields are added to your CPT’s REST API endpoint. Their documentation also says

    Pods allows you to make your Pods fields available for reading and/ or writing in the route for your Pods custom content type. This functionality is disabled by default. It can be enabled for all fields, or per field.”

    I am not sure how you enable this field by field but I am sure you can figure it out.

    So, in conclusion, the PODS plugin does what our plugin does and you should probably leverage that existing functionality instead of mixing the two. Alternatively, you could try disabling the REST API via PODS and testing if our plugin will re-enable it but, as I said before, it’s probably best to rely on PODS native functionality than to mix the two.

    I hope that all makes sense. Let me know if that works for you.

    Cheers,
    Kevin.

    Thread Starter Quint

    (@qrahaman)

    Hello Kevin,

    Thank you for your investigation. You are correct. PODS appears to override your plugin no matter how I set the visibility within a PODS custom post type. Thank you again.

    Plugin Contributor yikesitskevin

    (@yikesitskevin)

    Hey @qrahaman,

    No problem! You should be fine using the PODS code though, right? Is there anything our plugin does that PODS isn’t doing?

    Even if you turn off the REST API configuration in Pods? Granted, if you want to show relationship fields, Pods REST API Endpoint would be required. Also anything you’re not seeing, let us know immediately with a bug report and we can verify and get it fixed so it’s reporting properly.

    Sorry to just now be jumping into this one, for some reason my ‘pods’ mention notification didn’t show up for this forum post.

    Jim @ Pods

    Thread Starter Quint

    (@qrahaman)

    @jimtrue and @yikesitskevin,

    As Jim suggested, I disabled the REST API support for my POD (REST API tab) and I was able to selectively specify visibility for fields in my POD using Kevin’s plugin. The JSON output reflected the desired output. However, maintaining that setting in PODS means that I can’t create a POD submission on the front-end.

    So, as Kevin suggested, my deliverable was met by using PODS to specify what data to return in the response object in lieu of his plugin.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘All Fields Being Returned Despite Visibility Being Turned Off For All Fields’ is closed to new replies.