Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update custom post type criteria #36

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

connorjburton
Copy link
Contributor

I feel like limiting the post types that the acf field gets added to is currently incorrect, let says you have some blocks on a homepage that you want to be able to query using get_posts but you don't want each individually viewable, you would set that post_type to public: false, publicly_queryable: true

The small change I PR'd fixes this scenario, allowing you to see ACF fields for those types of post types.

I feel like limiting the post types that the acf field gets added to is currently incorrect, let says you have some blocks on a homepage that you want to be able to query using ```get_posts``` but you don't want each individually viewable, you would set that ```post_type``` to ```public: false, publicly_queryable: true```

The small change I PR'd fixes this scenario, allowing you to see ACF fields for those types of post types.
@chrishutchinson
Copy link
Contributor

Sounds good - would there ever be a case that 'publicly_queryable' => true wouldn't pick up a post type that 'public' => true would?

I can't recall of the top of my head how each will work?

@connorjburton
Copy link
Contributor Author

Hmm good point, it may need to check if public or publicly_queryable are true then.

@connorjburton
Copy link
Contributor Author

Maybe there is a better way, you have to add show_in_rest when registering a custom post type to be included in the WP API, couldn't we just query by that.

My second thought is does WP API do any checks on custom post types, or does it just let any CPT with show_in_rest return data. We should probably match what WP API does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants