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:


  • 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


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.