CalebBarnes/nextwp

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

Opened this issue · 0 comments

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.