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

Post type created with ACF with a custom url slug does not load correct url slug #54

Open
CalebBarnes opened this issue Feb 15, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@CalebBarnes
Copy link
Owner

CalebBarnes commented Feb 15, 2024

Post type created with ACF with a custom url slug does not match what is returned by /wp-json/wp/v2/types

Example:
Post type "solution-or-product"
image

custom url slug "solutions-and-products"
image

response from WP REST API /wp-json/wp/v2/types:

  "solution-or-product": {
    "description": "",
    "hierarchical": false,
    "has_archive": false,
    "name": "Solutions & Products",
    "slug": "solution-or-product",
    "icon": "",
    "taxonomies": [],
    "rest_base": "solution-or-product",
    "rest_namespace": "wp/v2",
    "yoast_head": null,
    "yoast_head_json": null,
  }

The getPageData function uses this /types endpoint to compare the slug of the requests page uri then determines which post type to fetch and which template to load. This will not work in this case because ACF custom slug is not accurate in the REST API.

Not sure if this is also a problem with CPT UI or not.

@CalebBarnes CalebBarnes added the bug Something isn't working label Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant