0

I use register_taxonomy_for_object_type( 'category', 'page' ); to add a taxonomy to the Page, but the url doesn't show the page's category slug.

So is there any way to display the slug of the current category of the Page like:

domain.com/page-cat1/page1

domain.com/page-cat2/page2
3
  • How is your URL currently structured? Have you taken a look at the "Permalinks" page in Settings?
    – YourManDan
    Commented Mar 15, 2023 at 18:22
  • @YourManDan My current permalink setting: /%category%/%postname%/ , seem like category's slug not working on Page post type
    – pdutie94
    Commented Mar 16, 2023 at 2:19
  • There's not enough information here to work with yet, please revise your answer with your full relevant code for your register_taxonomy_for_object_type() function and the location you put the code in. Ensure you're using the proper add_action call as outlined here.
    – YourManDan
    Commented Mar 16, 2023 at 14:21

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.