• Resolved unique1233

    (@unique1233)


    Hi, I’ve implemented the custom post type on my WP Admin.

    I am using Frontity at the front-end. Which doesn’t matter.

    I have a problem adding Custom Post Type Archive link to the menu.

    When I add and save, the link is null.

    Any suggestions?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Making sure I’m understanding accurately.

    You’re using the native WordPress Nav Menu UI to add a perhaps a custom link that points to the archive URL, and then when viewing the frontend, it’s showing as either an empty attribute or perhaps literally the word null?

    Thread Starter unique1233

    (@unique1233)

    From the WordPress admin panel, I go to Appearance -> Menus -> On the left side of the screen my custom posts called Services appears and I have an option to check Services archive and add it as a link to primary menu.

    I am using Frontity on the front-end, so all of my wp content is being exposed via the API.

    After saving the menu, when visiting wp-json, this is what the link looks like:

    {
    “id”: 83,
    “order”: 3,
    “parent”: 0,
    “title”: “Services”,
    “url”: “https://dev.some-url.test/services/”,
    “attr”: “”,
    “target”: “”,
    “classes”: “”,
    “xfn”: “”,
    “description”: “”,
    “object_id”: 12,
    “object”: “services”,
    “object_slug”: null,
    “type”: “post_type_archive”,
    “type_label”: “Архива врсте чланака”
    }

    As you can see, the slug is null, therefore on the front-end side of the project, I cannot use the link as I should.

    The slug should be /services as this is the path to the services (custom post type) archive. Not sure why am I getting the null as a value to the link.

    Hope this helps.

    • This reply was modified 3 years, 10 months ago by unique1233.
    • This reply was modified 3 years, 10 months ago by unique1233.
    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Not sure what may be going on here, as we don’t do anything special, that’s specific to the REST API data, so this has me wondering if it’s something in WP core going on.

    That said, I’m trying to recreate visually where you’re pulling this data, so I can see if I can recreate myself.

    For example, I registered a post type and set it to have an archive and show in nav menus. I added the “All ___” item, but I’m not sure what REST API endpoint you’re looking at to get your output above.

    If you can provide that, I can check on my end.

    Thread Starter unique1233

    (@unique1233)

    I am using the WP REST API MENUS plugin to expose the menu data via the API.

    For example: https://dev.some-url.test/wp-json/wp-api-menus/v2/menus/2

    The 2 at the end represent the id of the menu. In this case 2 = primary menu.

    I am not sure if I need to set up anything else in the settings in order for this to work. Everything seems legit.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Gotcha,

    Was able to recreate, but I’m also thinking this may be more an issue with the plugin creating these menu endpoints more than it is anything with CPTUI. Worth checking in with them to see what their support says.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Custom Post Type Archive Link Menu’ is closed to new replies.